Class SocketWrapperBase.OperationState<A>
java.lang.Object
org.apache.tomcat.util.net.SocketWrapperBase.OperationState<A>
- Type Parameters:
A- The attachment type
- All Implemented Interfaces:
Runnable
- Enclosing class:
SocketWrapperBase<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AAttachment object passed to the completion handler.protected final SocketWrapperBase.BlockingModeBlocking mode for the operation.protected final ByteBuffer[]Buffers used for the vectored I/O operation.protected final AtomicBooleanFlag to ensure the completion handler is called only once.protected final SocketWrapperBase.CompletionCheckCompletion check to determine handler invocation.protected final SocketWrapperBase<E>.VectoredIOCompletionHandler<A> Vectored I/O completion handler.protected booleanIndicates whether the vectored I/O completion processing is done.protected final CompletionHandler<Long, ? super A> Completion handler to invoke when the operation completes.protected final intNumber of buffers in the operation.protected longTotal number of bytes transferred by the operation.protected final intOffset in the buffer array.protected final booleanIndicates whether this is a read operation.protected final SemaphoreSemaphore for synchronizing concurrent operations.protected SocketWrapperBase.CompletionStateCurrent completion state of the operation.protected final longTimeout value for the operation.protected final TimeUnitTime unit for the timeout. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long, ? super A> handler, Semaphore semaphore, SocketWrapperBase<E>.VectoredIOCompletionHandler<A> completion) Creates a new operation state for a vectored I/O operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidend()End the operation.protected booleanChecks if there is remaining outbound data in the buffers.protected abstract booleanisInline()Determines whether the operation is still executing on the original caller thread.protected booleanprocess()Process the operation using the connector executor.protected voidstart()Start the operation, this will typically call run.
-
Field Details
-
read
protected final boolean readIndicates whether this is a read operation. -
buffers
Buffers used for the vectored I/O operation. -
offset
protected final int offsetOffset in the buffer array. -
length
protected final int lengthNumber of buffers in the operation. -
attachment
Attachment object passed to the completion handler. -
timeout
protected final long timeoutTimeout value for the operation. -
unit
Time unit for the timeout. -
block
Blocking mode for the operation. -
check
Completion check to determine handler invocation. -
handler
Completion handler to invoke when the operation completes. -
semaphore
Semaphore for synchronizing concurrent operations. -
completion
Vectored I/O completion handler. -
callHandler
Flag to ensure the completion handler is called only once. -
nBytes
protected volatile long nBytesTotal number of bytes transferred by the operation. -
state
Current completion state of the operation. -
completionDone
protected boolean completionDoneIndicates whether the vectored I/O completion processing is done.
-
-
Constructor Details
-
OperationState
protected OperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long, ? super A> handler, Semaphore semaphore, SocketWrapperBase<E>.VectoredIOCompletionHandler<A> completion) Creates a new operation state for a vectored I/O operation.- Parameters:
read- Whether this is a read operationbuffers- The buffers for the operationoffset- The offset in the buffer arraylength- The number of buffersblock- The blocking modetimeout- The timeout durationunit- The timeout time unitattachment- An attachment objectcheck- The completion checkhandler- The completion handlersemaphore- The semaphore for synchronizationcompletion- The vectored I/O completion handler
-
-
Method Details
-
isInline
protected abstract boolean isInline()Determines whether the operation is still executing on the original caller thread.- Returns:
trueif the operation is still inline,falseif running on a separate thread
-
hasOutboundRemaining
protected boolean hasOutboundRemaining()Checks if there is remaining outbound data in the buffers.- Returns:
falseby default; overridden by NIO implementations
-
process
protected boolean process()Process the operation using the connector executor.- Returns:
- true if the operation was accepted, false if the executor rejected execution
-
start
protected void start()Start the operation, this will typically call run. -
end
protected void end()End the operation.
-