Interface Operation

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addClone​(Operation op)
      Add the clone from this operation.
      void cancel()
      Cancel this operation.
      java.nio.ByteBuffer getBuffer()
      Get the write buffer for this operation.
      OperationCallback getCallback()
      Get the callback for this get operation.
      int getCloneCount()
      Returns the number of times this operation has been cloned.
      byte[] getErrorMsg()
      Returns the raw bytes of the error message content.
      OperationException getException()
      Get the exception that occurred (or null if no exception occurred).
      MemcachedNode getHandlingNode()
      Get the node that should've been handling this operation.
      OperationState getState()
      Get the current state of this operation.
      long getWriteCompleteTimestamp()
      Returns the timestamp from the point where the WRITE was completed.
      void handleRead​(java.nio.ByteBuffer data)
      Handle a raw data read.
      boolean hasErrored()
      True if an error occurred while processing this operation.
      void initialize()
      Initialize this operation.
      boolean isCancelled()
      Has this operation been cancelled?
      boolean isTimedOut()
      True if the operation has timed out.
      boolean isTimedOut​(long ttlMillis)
      True if the operation has timed out.
      boolean isTimedOutUnsent()
      True if the operation has timed out and has not been sent.
      void readFromBuffer​(java.nio.ByteBuffer data)
      Read data from the given byte buffer and dispatch to the appropriate read mechanism.
      void setCloneCount​(int count)
      Sets the clone count for this operation.
      void setHandlingNode​(MemcachedNode to)
      Set a reference to the node that will be/is handling this operation.
      void timeOut()
      Mark this operation as one which has exceeded its timeout value.
      void writeComplete()
      Invoked after having written all of the bytes from the supplied output buffer.
      void writing()
      Invoked when we start writing all of the bytes from this operation to the sockets write buffer.
    • Method Detail

      • isCancelled

        boolean isCancelled()
        Has this operation been cancelled?
      • hasErrored

        boolean hasErrored()
        True if an error occurred while processing this operation.
      • getException

        OperationException getException()
        Get the exception that occurred (or null if no exception occurred).
      • getCallback

        OperationCallback getCallback()
        Get the callback for this get operation.
      • cancel

        void cancel()
        Cancel this operation.
      • getState

        OperationState getState()
        Get the current state of this operation.
      • getBuffer

        java.nio.ByteBuffer getBuffer()
        Get the write buffer for this operation.
      • writing

        void writing()
        Invoked when we start writing all of the bytes from this operation to the sockets write buffer.
      • writeComplete

        void writeComplete()
        Invoked after having written all of the bytes from the supplied output buffer.
      • initialize

        void initialize()
        Initialize this operation. This is used to prepare output byte buffers and stuff.
      • readFromBuffer

        void readFromBuffer​(java.nio.ByteBuffer data)
                     throws java.io.IOException
        Read data from the given byte buffer and dispatch to the appropriate read mechanism.
        Throws:
        java.io.IOException
      • handleRead

        void handleRead​(java.nio.ByteBuffer data)
        Handle a raw data read.
      • getHandlingNode

        MemcachedNode getHandlingNode()
        Get the node that should've been handling this operation.
      • setHandlingNode

        void setHandlingNode​(MemcachedNode to)
        Set a reference to the node that will be/is handling this operation.
        Parameters:
        to - a memcached node
      • timeOut

        void timeOut()
        Mark this operation as one which has exceeded its timeout value.
      • isTimedOut

        boolean isTimedOut()
        True if the operation has timed out.

        A timed out operation may or may not have been sent to the server already, but it exceeded either the specified or the default timeout value.

      • isTimedOut

        boolean isTimedOut​(long ttlMillis)
        True if the operation has timed out. The ttl allows the caller to specify how long the operation should have been given since its creation, returning true if the operation has exceeded that time period.

        A timed out operation may or may not have been sent to the server already, but it exceeded either the specified or the default timeout value.

        In the rare case this may be called with a longer timeout value after having been called with a shorter value that caused the operation to be timed out, an IllegalArgumentException may be thrown.

        Parameters:
        ttlMillis - the max amount of time an operation may have existed since its creation in milliseconds.
      • isTimedOutUnsent

        boolean isTimedOutUnsent()
        True if the operation has timed out and has not been sent. If the client has timed out this operation and knows it has not been written to the network, this will be true.
      • getWriteCompleteTimestamp

        long getWriteCompleteTimestamp()
        Returns the timestamp from the point where the WRITE was completed. This can be used to calculate the roundtrip time of the operation.
      • getErrorMsg

        byte[] getErrorMsg()
        Returns the raw bytes of the error message content.
        Returns:
        the raw error message content.
      • addClone

        void addClone​(Operation op)
        Add the clone from this operation.
        Parameters:
        op - the cloned operation.
      • getCloneCount

        int getCloneCount()
        Returns the number of times this operation has been cloned.
        Returns:
        the number of clones.
      • setCloneCount

        void setCloneCount​(int count)
        Sets the clone count for this operation.