Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.nio.transport

public final Class TCPNIOAsyncQueueWriter

extends AbstractNIOAsyncQueueWriter
Class Inheritance
Imports
java.io.IOException, java.net.SocketAddress, java.nio.channels.SocketChannel, java.util.ArrayDeque, .ArrayList, .Deque, .Iterator, java.util.logging.Level, .Logger, org.glassfish.grizzly.Buffer, .CloseReason, .CloseType, .Connection, .FileChunk, .Grizzly, .IOEvent, .WriteResult, org.glassfish.grizzly.asyncqueue.AsyncQueueWriter, .AsyncWriteQueueRecord, .RecordWriteResult, .TaskQueue, .WritableMessage, org.glassfish.grizzly.attributes.Attribute, org.glassfish.grizzly.memory.BufferArray, .CompositeBuffer, org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter, .DirectByteBufferRecord, .NIOConnection, .NIOTransport

The TCP transport AsyncQueueWriter implementation, based on the Java NIO
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Attribute<TCPNIOAsyncQueueWriter.CompositeQueueRecord>
private static final Logger
Inherited from org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter:
maxPendingBytesmaxWriteReentrantstransport

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AsyncWriteQueueRecord
aggregate(final TaskQueue<AsyncWriteQueueRecord> writeTaskQueue)

Overrides org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.aggregate.

Aggregates records in a queue to be written as one chunk.

private static boolean
private static AsyncWriteQueueRecord
private TCPNIOAsyncQueueWriter.CompositeQueueRecord
private static void
fill(final TCPNIOAsyncQueueWriter.CompositeQueueRecord queueRecord, final int totalBufferSize, final DirectByteBufferRecord ioRecord)

protected void
private RecordWriteResult<K, L>
update(final TCPNIOAsyncQueueWriter.CompositeQueueRecord queueRecord, final int written)

protected RecordWriteResult<K, L>
protected long
write0(final NIOConnection connection, final WritableMessage message, final WriteResult<WritableMessage, SocketAddress> currentResult)

private RecordWriteResult<K, L>
Inherited from org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter:
canWritecanWriteclosecreateRecordgetMaxPendingBytesPerConnectionisAllowDirectWriteisReadynotifyWritePossiblenotifyWritePossibleonCloseonWriteFailureprocessAsyncsetAllowDirectWritesetMaxPendingBytesPerConnectionwritewritewrite

Field Detail

COMPOSITE_BUFFER_ATTRback to summary
private static final Attribute<TCPNIOAsyncQueueWriter.CompositeQueueRecord> COMPOSITE_BUFFER_ATTR
LOGGERback to summary
private static final Logger LOGGER

Hides org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.LOGGER.

Constructor Detail

TCPNIOAsyncQueueWriterback to summary
public TCPNIOAsyncQueueWriter(final NIOTransport transport)

Method Detail

aggregateback to summary
protected AsyncWriteQueueRecord aggregate(final TaskQueue<AsyncWriteQueueRecord> writeTaskQueue)

Overrides org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.aggregate.

Doc from org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.aggregate.

Aggregates records in a queue to be written as one chunk.

Annotations
@Override
canBeAggregatedback to summary
private static boolean canBeAggregated(final AsyncWriteQueueRecord record)
checkAndGetNextRecordback to summary
private static AsyncWriteQueueRecord checkAndGetNextRecord(final TaskQueue<AsyncWriteQueueRecord> writeTaskQueue)
createCompositeQueueRecordback to summary
private TCPNIOAsyncQueueWriter.CompositeQueueRecord createCompositeQueueRecord(final AsyncWriteQueueRecord currentRecord)
fillback to summary
private static void fill(final TCPNIOAsyncQueueWriter.CompositeQueueRecord queueRecord, final int totalBufferSize, final DirectByteBufferRecord ioRecord)
onReadyToWriteback to summary
protected void onReadyToWrite(final NIOConnection connection) throws IOException

Implements abstract org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.onReadyToWrite.

Annotations
@Override
updateback to summary
private RecordWriteResult<K, L> update(final TCPNIOAsyncQueueWriter.CompositeQueueRecord queueRecord, final int written)
write0back to summary
protected RecordWriteResult<K, L> write0(final NIOConnection connection, final AsyncWriteQueueRecord queueRecord) throws IOException

Implements abstract org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.write0.

Annotations
@Override
@SuppressWarnings:unchecked
write0back to summary
protected long write0(final NIOConnection connection, final WritableMessage message, final WriteResult<WritableMessage, SocketAddress> currentResult) throws IOException
Annotations
@SuppressWarnings:unchecked
writeCompositeRecordback to summary
private RecordWriteResult<K, L> writeCompositeRecord(final NIOConnection connection, final TCPNIOAsyncQueueWriter.CompositeQueueRecord queueRecord) throws IOException
org.glassfish.grizzly.nio.transport back to summary

private final Class TCPNIOAsyncQueueWriter.CompositeQueueRecord

extends AsyncWriteQueueRecord
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Deque<AsyncWriteQueueRecord>
private final ArrayList<BufferArray>
private int
Inherited from org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord:
UNCOUNTABLE_RECORD_SPACE_VALUE

Constructor Summary

AccessConstructor and Description
public
CompositeQueueRecord(final Connection<L> connection)

Method Summary

Modifier and TypeMethod and Description
public void
append(final AsyncWriteQueueRecord queueRecord)

public boolean
public static TCPNIOAsyncQueueWriter.CompositeQueueRecord
create(final Connection<L> connection)

public boolean
public boolean
public void
public void
public void
public long
Inherited from org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord:
creategetBytesToReservegetCurrentResultgetDstAddressgetInitialMessageSizegetPushBackHandlergetWritableMessageresetsetsetUncountable

Field Detail

queueback to summary
private final Deque<AsyncWriteQueueRecord> queue
savedBufferStatesback to summary
private final ArrayList<BufferArray> savedBufferStates
sizeback to summary
private int size

Constructor Detail

CompositeQueueRecordback to summary
public CompositeQueueRecord(final Connection<L> connection)

Method Detail

appendback to summary
public void append(final AsyncWriteQueueRecord queueRecord)
canBeAggregatedback to summary
public boolean canBeAggregated()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.canBeAggregated.

Annotations
@Override
createback to summary
public static TCPNIOAsyncQueueWriter.CompositeQueueRecord create(final Connection<L> connection)
isFinishedback to summary
public boolean isFinished()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.isFinished.

Annotations
@Override
isUncountableback to summary
public boolean isUncountable()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.isUncountable.

Annotations
@Override
notifyCompleteAndRecycleback to summary
public void notifyCompleteAndRecycle()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.notifyCompleteAndRecycle.

Annotations
@Override
notifyFailureback to summary
public void notifyFailure(final Throwable e)

Overrides org.glassfish.grizzly.asyncqueue.AsyncQueueRecord.notifyFailure.

Annotations
@Override
recycleback to summary
public void recycle()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.recycle.

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
remainingback to summary
public long remaining()

Overrides org.glassfish.grizzly.asyncqueue.AsyncWriteQueueRecord.remaining.

Annotations
@Override