Package com.tangosol.coherence.commonj
Class WorkManager.RemoteWorkManager
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.coherence.commonj.WorkManager.RemoteWorkManager
-
- All Implemented Interfaces:
commonj.work.WorkManager
- Enclosing class:
- WorkManager
protected class WorkManager.RemoteWorkManager extends Base implements commonj.work.WorkManager
RemoteWorkManager is a delegating WorkManager wrapper.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected Member
m_memberPinned
The service Member this RemoteWorkManager is pinned to.
-
Constructor Summary
Constructors Constructor Description RemoteWorkManager(Member memberPinned)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description commonj.work.WorkItem
schedule(commonj.work.Work work)
Dispatches a Work asynchronously.commonj.work.WorkItem
schedule(commonj.work.Work work, commonj.work.WorkListener workListener)
Dispatches a Work asynchronously.protected commonj.work.WorkItem
schedule(commonj.work.Work work, commonj.work.WorkListener workListener, Member member)
Accepts a Work instance for processing at the specified Member.boolean
waitForAll(Collection collWorkItems, long lTimeoutMillis)
Wait for all WorkItems in the collection to finish successfully or otherwise.Collection
waitForAny(Collection collWorkItems, long lTimeoutMillis)
Wait for any of the WorkItems in the collection to finish.-
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 Detail
-
m_memberPinned
protected Member m_memberPinned
The service Member this RemoteWorkManager is pinned to.
-
-
Constructor Detail
-
RemoteWorkManager
public RemoteWorkManager(Member memberPinned)
-
-
Method Detail
-
schedule
public commonj.work.WorkItem schedule(commonj.work.Work work) throws commonj.work.WorkException, IllegalArgumentException
Dispatches a Work asynchronously. The work is dispatched and the method returns immediately.If a JVM that this pinned WorkManager represents has failed then a
WorkRejectedException
will be thrown even if the remote JVM restarts. The pinned WorkManager must be refreshed by using a normal WorkManager and then acquiring a new pinned WorkManager.- Specified by:
schedule
in interfacecommonj.work.WorkManager
- Parameters:
work
- the Work to execute- Returns:
- the WorkItem representing the asynchronous work; since the Work must be serializable, a RemoteWorkItem is always returned
- Throws:
commonj.work.WorkException
- thrown if queuing this up results in an exceptionIllegalArgumentException
- thrown if work is a javax.ejb.EnterpriseBean.
-
schedule
public commonj.work.WorkItem schedule(commonj.work.Work work, commonj.work.WorkListener workListener) throws commonj.work.WorkException, IllegalArgumentException
Dispatches a Work asynchronously. The work is dispatched and the method returns immediately.If a JVM that this pinned WorkManager represents has failed then a
WorkRejectedException
will be thrown even if the remote JVM restarts. The pinned WorkManager must be refreshed by using a normal WorkManager and then acquiring a new pinned WorkManager.- Specified by:
schedule
in interfacecommonj.work.WorkManager
- Parameters:
work
- the Work to executeworkListener
- can be null or a WorkListener which is used to inform the application of the progress of a Work.- Returns:
- the WorkItem representing the asynchronous work; since the Work must be serializable, a RemoteWorkItem is always returned
- Throws:
commonj.work.WorkException
- thrown if queuing this up results in an exceptionIllegalArgumentException
- thrown if work is a javax.ejb.EnterpriseBean.
-
schedule
protected commonj.work.WorkItem schedule(commonj.work.Work work, commonj.work.WorkListener workListener, Member member) throws commonj.work.WorkException
Accepts a Work instance for processing at the specified Member.- Parameters:
work
- the Work to executeworkListener
- an optional WorkListener which is used to inform the application of the progress of a Workmember
- the Member to execute the Work at- Returns:
- a WorkItem representing scheduled Work
- Throws:
commonj.work.WorkException
- thrown if queuing this up results in an exception
-
waitForAll
public boolean waitForAll(Collection collWorkItems, long lTimeoutMillis) throws InterruptedException, IllegalArgumentException
Description copied from interface:commonj.work.WorkManager
Wait for all WorkItems in the collection to finish successfully or otherwise. WorkItems from different WorkManagers can be placed in a single collection and waited on together.The WorkItems collection should not be altered once submitted until the method returns.
- Specified by:
waitForAll
in interfacecommonj.work.WorkManager
- Parameters:
collWorkItems
- the Collection of WorkItem objects to wait for.lTimeoutMillis
- the timout in milliseconds. If this is 0 then this method returns immediately.- Returns:
- true if all WorkItems have completed, false if the timeout has expired.
- Throws:
InterruptedException
- thrown if the wait is interrupted.IllegalArgumentException
- thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout_ms is negative.- See Also:
WorkManager.waitForAll(java.util.Collection, long)
-
waitForAny
public Collection waitForAny(Collection collWorkItems, long lTimeoutMillis) throws InterruptedException, IllegalArgumentException
Description copied from interface:commonj.work.WorkManager
Wait for any of the WorkItems in the collection to finish. If there are no WorkItems in the list then it returns immediately indicating a timeout. WorkItems from different WorkManagers can be placed in a single collection and waited on together.The WorkItems collection should not be altered once submitted until the method returns.
- Specified by:
waitForAny
in interfacecommonj.work.WorkManager
- Parameters:
collWorkItems
- the Collection of WorkItem objects to wait for.lTimeoutMillis
- the timeout in ms. If this is 0 then the method returns immediately, i.e. does not block.- Returns:
- the WorkItems that have completed or an empty Collection if it time out expires before any finished.
- Throws:
InterruptedException
- thrown if the wait is interrupted.IllegalArgumentException
- thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout_ms is negative.- See Also:
WorkManager.waitForAny(java.util.Collection, long)
-
-