Package com.tangosol.net.cache
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
Bundle represents a unit of optimized execution.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Attempt to bundle encountered and exception; the execution has to be de-optimized and performed by individual threads.static final int
This Bundle accepting additional items.static final int
This Bundle is closed for accepting additional items and awaiting for the execution results.static final int
This Bundle is in process of returning the result of execution back to the client. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Obtain results of the bundled requests.protected boolean
ensureResults
(boolean fBurst) Obtain results of the bundled requests or ensure that the results have already been retrieved.protected String
formatStatusName
(int iStatus) Return a human readable name for the specified status value.protected int
Obtain this bundle size.protected boolean
Check whether or not this bundle is in the "exception" state - bundled execution threw an exception and requests have to be un-bundled.protected boolean
isMaster()
Check whether or not this is a "master" Bundle.protected boolean
isOpen()
Check whether or not this bundle is open for adding request elements.protected boolean
Check whether or not this bundle is in the "pending" state - awaiting for the execution results.protected boolean
Check whether or not this bundle is in the "processed" state - ready to return the result of execution back to the client.protected boolean
Release all bundle resources associated with the current thread.void
Reset statistics for this Bundle.protected void
Designate this Bundle as a "master" bundle.protected void
setStatus
(int iStatus) Change the status of this Bundle.toString()
Provide a human readable description for the Bundle object (for debugging).protected boolean
waitForResults
(boolean fFirst) Wait until results of bundled requests are retrieved.Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
STATUS_OPEN
public static final int STATUS_OPENThis Bundle accepting additional items.- See Also:
-
STATUS_PENDING
public static final int STATUS_PENDINGThis Bundle is closed for accepting additional items and awaiting for the execution results.- See Also:
-
STATUS_PROCESSED
public static final int STATUS_PROCESSEDThis Bundle is in process of returning the result of execution back to the client.- See Also:
-
STATUS_EXCEPTION
public static final int STATUS_EXCEPTIONAttempt 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 thegetSizeThreshold
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
Provide a human readable description for the Bundle object (for debugging). -
formatStatusName
Return a human readable name for the specified status value.- Parameters:
iStatus
- the status value to format- Returns:
- a human readable status name
-