Search in sources :

Example 11 with JournalNetworkException

use of com.questdb.std.ex.JournalNetworkException in project questdb by bluestreak01.

the class HugeBufferProducer method write.

@Override
public void write(WritableByteChannel channel) throws JournalNetworkException {
    long target = hb.getAppendOffset();
    Unsafe.getUnsafe().putLong(headerAddress, target);
    header.position(0);
    try {
        channel.write(header);
        long pos = 0;
        while (pos < target) {
            pos += ByteBuffers.copy(hb.getBuffer(pos), channel, target - pos);
        }
    } catch (IOException e) {
        throw new JournalNetworkException(e);
    }
}
Also used : JournalNetworkException(com.questdb.std.ex.JournalNetworkException) IOException(java.io.IOException)

Aggregations

JournalNetworkException (com.questdb.std.ex.JournalNetworkException)11 IOException (java.io.IOException)7 IncompatibleJournalException (com.questdb.ex.IncompatibleJournalException)2 JournalDeltaConsumer (com.questdb.net.ha.comsumer.JournalDeltaConsumer)2 IndexedJournalKey (com.questdb.net.ha.model.IndexedJournalKey)2 JournalException (com.questdb.std.ex.JournalException)2 DatagramChannel (java.nio.channels.DatagramChannel)2 SecureSocketChannel (com.questdb.net.SecureSocketChannel)1 SslConfig (com.questdb.net.SslConfig)1 StatsCollectingReadableByteChannel (com.questdb.net.StatsCollectingReadableByteChannel)1 HugeBufferConsumer (com.questdb.net.ha.comsumer.HugeBufferConsumer)1 DatagramChannelWrapper (com.questdb.net.ha.config.DatagramChannelWrapper)1 IndexedJournal (com.questdb.net.ha.model.IndexedJournal)1 JournalServerState (com.questdb.net.ha.model.JournalServerState)1 Partition (com.questdb.store.Partition)1 JournalMetadata (com.questdb.store.factory.configuration.JournalMetadata)1 File (java.io.File)1 InetSocketAddress (java.net.InetSocketAddress)1 ByteBuffer (java.nio.ByteBuffer)1 Selector (java.nio.channels.Selector)1