Class WorkManager.WorkHolder
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.commonj.WorkManager.WorkHolder
- All Implemented Interfaces:
commonj.work.RemoteWorkItem,commonj.work.WorkItem,Comparable
- Enclosing class:
WorkManager
A holder for a Work object that serves as a communication intermediary
between a client and a [remote] service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA WorkEvent implementation.Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected commonj.work.WorkListenerA work listener associated with the corresponding Work.protected ListA list of collections waiting for this Work to complete.protected longThe corresponding work id.protected MemberThe server Member that is to run the Work.protected InvocationServiceThe underlying Invocation service.protected WorkManager.WorkStatusCurrent Work status. -
Constructor Summary
ConstructorsConstructorDescriptionWorkHolder(long lWorkId, commonj.work.WorkListener listener, InvocationService service, Member member) Construct a WorkHolder for a Work with a given work id that is scheduled to be executed on a specified service. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWait(Collection collWait) Add a collection to a wait list.intCompare this WorkItem with the specified object for order.booleanCompare this WorkItem with the specified object for equality.commonj.work.WorkListenerReturn the associated WorkListener.commonj.work.WorkManagerReturn a pinned WorkManager which represents the JVM that was used to execute this Work.commonj.work.WorkReturn the Work once it has completed.Return the InvocationService used to execute the corresponding Work.intReturn the current status of dispatching the Work.Return the Member that the corresponding Work is to be executed at.getWaits()Assemble an array of collection that wait for this Work.longReturn the work id.Return the WorkStatus object.inthashCode()Return a hash code value for this WorkHolder.voidrelease()Calls the remote Work object'sWork.release()method.voidremoveWait(Collection collWait) Remove a collection from a wait list.protected voidsetWorkStatus(WorkManager.WorkStatus status) Update the WorkStatus.toString()Return a string representation of the WorkHolder object.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, newHashMap, newHashMap, newHashSet, newHashSet, 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
-
m_lWorkId
protected long m_lWorkIdThe corresponding work id. -
m_listener
protected commonj.work.WorkListener m_listenerA work listener associated with the corresponding Work. -
m_service
The underlying Invocation service. -
m_member
The server Member that is to run the Work. -
m_status
Current Work status. -
m_listWaits
A list of collections waiting for this Work to complete. Usually this list contains no more than one item.
-
-
Constructor Details
-
WorkHolder
public WorkHolder(long lWorkId, commonj.work.WorkListener listener, InvocationService service, Member member) Construct a WorkHolder for a Work with a given work id that is scheduled to be executed on a specified service.- Parameters:
lWorkId- the Work idlistener- the WorkListenerservice- the InvocationService to usemember- the target Member
-
-
Method Details
-
getStatus
public int getStatus()Return the current status of dispatching the Work. SeeWorkEventfor the values.- Specified by:
getStatusin interfacecommonj.work.WorkItem- Returns:
- the work status
- See Also:
-
getResult
public commonj.work.Work getResult() throws commonj.work.WorkExceptionReturn the Work once it has completed. If the Work threw an exception during run then the exception is re-thrown here.- Specified by:
getResultin interfacecommonj.work.WorkItem- Returns:
- the completed Work or null if the Work is not yet complete.
- Throws:
commonj.work.WorkException- if an exception is thrown in the Work
-
getPinnedWorkManager
public commonj.work.WorkManager getPinnedWorkManager()Return a pinned WorkManager which represents the JVM that was used to execute this Work.- Specified by:
getPinnedWorkManagerin interfacecommonj.work.RemoteWorkItem- Returns:
- the WorkManager associated with the JVM that was used to execute this RemoteWorkItem
-
release
public void release()Calls the remote Work object'sWork.release()method.- Specified by:
releasein interfacecommonj.work.RemoteWorkItem
-
compareTo
Compare this WorkItem with the specified object for order.- Specified by:
compareToin interfaceComparable
-
getWorkId
public long getWorkId()Return the work id.- Returns:
- the work id.
-
getWorkStatus
Return the WorkStatus object.- Returns:
- the WorkStatus object
-
getService
Return the InvocationService used to execute the corresponding Work.- Returns:
- the InvocationService reference
-
getTargetMember
Return the Member that the corresponding Work is to be executed at.- Returns:
- the target Member
-
getListener
public commonj.work.WorkListener getListener()Return the associated WorkListener.- Returns:
- the listener object
-
setWorkStatus
Update the WorkStatus.- Parameters:
status- the WorkStatus object to update
-
addWait
Add a collection to a wait list.- Parameters:
collWait- a collection that waits for this Work
-
removeWait
Remove a collection from a wait list. The collection must have been added using theaddWait(java.util.Collection)call.- Parameters:
collWait- a collection that waits for this Work
-
getWaits
Assemble an array of collection that wait for this Work.- Returns:
- an array of collections that wait for this Work
-
hashCode
-
equals
-
toString
-