Class AbstractBundler.Bundle

java.lang.Object
com.tangosol.util.Base
com.tangosol.net.cache.AbstractBundler.Bundle
Direct Known Subclasses:
AbstractBinaryEntryBundler.Bundle, AbstractEntryBundler.Bundle, AbstractKeyBundler.Bundle
Enclosing class:
AbstractBundler

protected abstract class AbstractBundler.Bundle extends Base
Bundle represents a unit of optimized execution.
  • Field Details

    • STATUS_OPEN

      public static final int STATUS_OPEN
      This Bundle accepting additional items.
      See Also:
    • STATUS_PENDING

      public static final int STATUS_PENDING
      This Bundle is closed for accepting additional items and awaiting for the execution results.
      See Also:
    • STATUS_PROCESSED

      public static final int STATUS_PROCESSED
      This Bundle is in process of returning the result of execution back to the client.
      See Also:
    • STATUS_EXCEPTION

      public static final int STATUS_EXCEPTION
      Attempt to bundle encountered and exception; the execution has to be de-optimized and performed by individual threads.
      See Also:
  • Constructor Details

    • Bundle

      protected Bundle()
      Default constructor.
  • Method Details

    • isOpen

      protected boolean isOpen()
      Check whether or not this bundle is open for adding request elements.
      Returns:
      true iff this Bundle is still open
    • isPending

      protected boolean isPending()
      Check whether or not this bundle is in the "pending" state - awaiting for the execution results.
      Returns:
      true iff this Bundle is in the "pending" state
    • isProcessed

      protected boolean isProcessed()
      Check whether or not this bundle is in the "processed" state - ready to return the result of execution back to the client.
      Returns:
      true iff this Bundle is in the "processed" state
    • isException

      protected boolean isException()
      Check whether or not this bundle is in the "exception" state - bundled execution threw an exception and requests have to be un-bundled.
      Returns:
      true iff this Bundle is in the "exception" state
    • setStatus

      protected void setStatus(int iStatus)
      Change the status of this Bundle.
      Parameters:
      iStatus - the new status value
    • getBundleSize

      protected int getBundleSize()
      Obtain this bundle size. The return value should be expressed in the same units as the value returned by the getSizeThreshold method.
      Returns:
      the bundle size
    • isMaster

      protected boolean isMaster()
      Check whether or not this is a "master" Bundle.
      Returns:
      true iff this Bundle is a designated "master" Bundle
    • setMaster

      protected void setMaster()
      Designate this Bundle as a "master" bundle.
    • ensureResults

      protected abstract void ensureResults()
      Obtain results of the bundled requests. This method should be implemented by concrete Bundle implementations using the most efficient mechanism.
    • waitForResults

      protected boolean waitForResults(boolean fFirst)
      Wait until results of bundled requests are retrieved.

      Note that calls to this method must be externally synchronized.

      Parameters:
      fFirst - true iff this is the first thread entering the bundle
      Returns:
      true if this thread is supposed to perform an actual bundled operation (burst); false otherwise
    • ensureResults

      protected boolean ensureResults(boolean fBurst)
      Obtain results of the bundled requests or ensure that the results have already been retrieved.
      Parameters:
      fBurst - specifies whether or not the actual results have to be fetched on this thread; this parameter will be true for one and only one thread per bundle
      Returns:
      true if the bundling has succeeded; false if the un-bundling has to be performed as a result of a failure
    • releaseThread

      protected boolean releaseThread()
      Release all bundle resources associated with the current thread.
      Returns:
      true iff all entered threads have released
    • resetStatistics

      public void resetStatistics()
      Reset statistics for this Bundle.
    • toString

      public String toString()
      Provide a human readable description for the Bundle object (for debugging).
      Overrides:
      toString in class Object
      Returns:
      a human readable description for the Bundle object
    • formatStatusName

      protected String formatStatusName(int iStatus)
      Return a human readable name for the specified status value.
      Parameters:
      iStatus - the status value to format
      Returns:
      a human readable status name