|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.AsynchronousAgent
com.tangosol.util.processor.AsynchronousProcessor
public class AsynchronousProcessor
A marker EntryProcessor
wrapper class that allows for an asynchronous invocation of the underlying processor. When used as a Future
(without extending), this implementation will collect the results of asynchronous invocation into a Map, providing the result
semantics identical to the EntryProcessor.processAll
contract.
More advanced use would require extending this class and overriding onResult(java.util.Map.Entry)
, onComplete()
, and onException(java.lang.Throwable)
methods. It's very important that overriding implementations of these methods must be non-blocking. For example, any use of NamedCache
API is completely disallowed with the only exception of AsynchronousAggregators
and AsynchronousProcessors
with disabled flow control.
The underlying entry processor is guaranteed to have been fully executed when onComplete()
is called.
Note 1: Neither this class nor its extensions need to be serializable. Only the underlying processor is serialized and sent to corresponding servers for execution.
Note 2: This feature is not available on Coherence*Extend clients.
AsynchronousAggregator
Field Summary | |
---|---|
protected java.util.List |
m_listResultEntries List of result value entries. |
protected InvocableMap.EntryProcessor |
m_processor The underlying entry processor. |
Fields inherited from class com.tangosol.util.AsynchronousAgent |
---|
m_control, m_eReason, m_fFlowControl, m_iOrderId, m_oResult |
Constructor Summary | |
---|---|
AsynchronousProcessor(InvocableMap.EntryProcessor processor) Construct an AsynchronousProcessor for a given processor and the automatic flow control "on" |
|
AsynchronousProcessor(InvocableMap.EntryProcessor processor, boolean fFlowControl) Construct an AsynchronousProcessor for a given processor. |
|
AsynchronousProcessor(InvocableMap.EntryProcessor processor, boolean fFlowControl, int iUnitOrderId) Construct an AsynchronousProcessor for a given processor. |
Method Summary | |
---|---|
InvocableMap.EntryProcessor |
getProcessor() Obtain the underlying entry processor. |
int |
getUnitOfOrderId() Return a unit-of-order id associated with this processor. |
void |
onComplete() Called after the processor has been notified about all possible partial results or failures and no more are forthcoming. |
void |
onException(java.lang.Throwable eReason) Called if any part of the operation failed for any reason. |
void |
onResult(java.util.Map.Entry entry) Called when there is a partial result of the asynchronous execution. |
java.lang.Object |
process(InvocableMap.Entry entry) Not supported. |
java.util.Map |
processAll(java.util.Set setEntries) Not supported. |
Methods inherited from class com.tangosol.util.AsynchronousAgent |
---|
bind, cancel, checkBacklog, drainBacklog, flush, get, get, isAutoFlowControl, isCancelled, isDone, setException, setResult, toString |
Field Detail |
---|
protected final InvocableMap.EntryProcessor m_processor
protected java.util.List m_listResultEntries
Constructor Detail |
---|
public AsynchronousProcessor(InvocableMap.EntryProcessor processor)
processor
- the underlying InvocableMap.EntryProcessor
public AsynchronousProcessor(InvocableMap.EntryProcessor processor, boolean fFlowControl)
processor
- the underlying InvocableMap.EntryProcessor
fFlowControl
- if true, the calling thread could be held by the service flow control logic (based on the destination backlog); otherwise it's the caller's responsibility to modulate the request flow (e.g. ensure that the invocation rate does not outpace the response rate)public AsynchronousProcessor(InvocableMap.EntryProcessor processor, boolean fFlowControl, int iUnitOrderId)
processor
- the underlying InvocableMap.EntryProcessor
fFlowControl
- if true, the calling thread could be held by the service flow control logic (based on the destination backlog); otherwise it's the caller's responsibility to modulate the request flow (e.g. ensure that the invocation rate does not outpace the response rate)iUnitOrderId
- the unit-of-order id for this processorMethod Detail |
---|
public void onResult(java.util.Map.Entry entry)
For a given request, calls to this method and onException(java.lang.Throwable)
may come concurrently.
For ordering guarantees across different processor invocations see getUnitOfOrderId()
.
Note: Overriding implementations of this method must be non-blocking.
entry
- an entry holding the key and a result of the operation for the given keypublic void onComplete()
InvocableMap
's methods, this method is guaranteed to be called once and only once.
Possible call back sequences are:
cache.invoke ... onResult onComplete cache.invoke ... onException onComplete cache.invokeAll ... onResult onException onException onResult onCompleteFor ordering guarantees across processors see
getUnitOfOrderId()
.
Note: Overriding implementations of this method must be non-blocking.
public void onException(java.lang.Throwable eReason)
"complete"
the operation.
Note: Overriding implementations of this method must be non-blocking.
eReason
- the reason of failurepublic int getUnitOfOrderId()
If two consecutive "invoke" calls are made using AsynchronousProcessors
with the same order id and the same key set, then the corresponding execution
and calls to onResult(java.util.Map.Entry)
are going to happen in the exact same order.
If two consecutive "invoke" calls are made using AsynchronousProcessors
with the same order id and the same partition set, then the the corresponding execution
and calls to onComplete()
are going to happen in the exact same order.
Note 1: The ordering guarantee is respected between AsynchronousProcessors
and AsynchronousAggregator
s with the same unit-of-order id.
Note 2: There is no ordering guarantees between asynchronous and synchronous operations.
public InvocableMap.EntryProcessor getProcessor()
public java.lang.Object process(InvocableMap.Entry entry)
process
in interface InvocableMap.EntryProcessor
entry
- the Entry to process Note: if this method throws an exception, all modifications to the supplied entry or any other entries retrieved via the BackingMapContext.getBackingMapEntry(java.lang.Object)
API will be rolled back leaving all underlying values unchanged.public java.util.Map processAll(java.util.Set setEntries)
processAll
in interface InvocableMap.EntryProcessor
setEntries
- a Set of InvocableMap.Entry objects to process
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |