Package org.apache.tomcat.util.net

## Class SocketWrapperBase.OperationState<A>

- java.lang.Object
- - org.apache.tomcat.util.net.SocketWrapperBase.OperationState<A>

- All Implemented Interfaces:
    `java.lang.Runnable`
  Enclosing class:
    SocketWrapperBase<E>

      protected abstract class SocketWrapperBase.OperationState<A>
      extends java.lang.Object
      implements java.lang.Runnable

  Internal state tracker for vectored operations.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected A` | `attachment` |
    `protected SocketWrapperBase.BlockingMode` | `block` |
    `protected java.nio.ByteBuffer[]` | `buffers` |
    `protected java.util.concurrent.atomic.AtomicBoolean` | `callHandler` |
    `protected SocketWrapperBase.CompletionCheck` | `check` |
    `protected SocketWrapperBase.VectoredIOCompletionHandler<A>` | `completion` |
    `protected boolean` | `completionDone` |
    `protected java.nio.channels.CompletionHandler<java.lang.Long,​? super A>` | `handler` |
    `protected int` | `length` |
    `protected long` | `nBytes` |
    `protected int` | `offset` |
    `protected boolean` | `read` |
    `protected java.util.concurrent.Semaphore` | `semaphore` |
    `protected SocketWrapperBase.CompletionState` | `state` |
    `protected long` | `timeout` |
    `protected java.util.concurrent.TimeUnit` | `unit` |

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `OperationState​(boolean read, java.nio.ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, java.util.concurrent.TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, java.nio.channels.CompletionHandler<java.lang.Long,​? super A> handler, java.util.concurrent.Semaphore semaphore, SocketWrapperBase.VectoredIOCompletionHandler<A> completion)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `end()` | End the operation.
    `protected boolean` | `hasOutboundRemaining()` |
    `protected abstract boolean` | `isInline()` |
    `protected boolean` | `process()` | Process the operation using the connector executor.
    `protected void` | `start()` | Start the operation, this will typically call run.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Runnable

      `run`

- - ### Field Detail

    - #### read

          protected final boolean read

    - #### buffers

          protected final java.nio.ByteBuffer[] buffers

    - #### offset

          protected final int offset

    - #### length

          protected final int length

    - #### attachment

          protected final A attachment

    - #### timeout

          protected final long timeout

    - #### unit

          protected final java.util.concurrent.TimeUnit unit

    - #### block

          protected final SocketWrapperBase.BlockingMode block

    - #### check

          protected final SocketWrapperBase.CompletionCheck check

    - #### handler

          protected final java.nio.channels.CompletionHandler<java.lang.Long,​? super A> handler

    - #### semaphore

          protected final java.util.concurrent.Semaphore semaphore

    - #### completion

          protected final SocketWrapperBase.VectoredIOCompletionHandler<A> completion

    - #### callHandler

          protected final java.util.concurrent.atomic.AtomicBoolean callHandler

    - #### nBytes

          protected volatile long nBytes

    - #### state

          protected volatile SocketWrapperBase.CompletionState state

    - #### completionDone

          protected boolean completionDone

  - ### Constructor Detail

    - #### OperationState

          protected OperationState​(boolean read,
                                   java.nio.ByteBuffer[] buffers,
                                   int offset,
                                   int length,
                                   SocketWrapperBase.BlockingMode block,
                                   long timeout,
                                   java.util.concurrent.TimeUnit unit,
                                   A attachment,
                                   SocketWrapperBase.CompletionCheck check,
                                   java.nio.channels.CompletionHandler<java.lang.Long,​? super A> handler,
                                   java.util.concurrent.Semaphore semaphore,
                                   SocketWrapperBase.VectoredIOCompletionHandler<A> completion)

  - ### Method Detail

    - #### isInline

          protected abstract boolean isInline()

      Returns:
        true if the operation is still inline, false if the operation is running on a thread that is not the original caller

    - #### hasOutboundRemaining

          protected boolean hasOutboundRemaining()

    - #### 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.