K - the type of the Map entry keyV - the type of the Map entry valueR - the type of value returned by the EntryProcessorpublic class AsynchronousProcessor<K,V,R> extends AbstractAsynchronousProcessor<K,V,R,Map<K,R>>
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<K, R>), onComplete(), and onException(java.lang.Throwable) methods.
It is very important that the overriding implementations of these methods
must be non-blocking. For example, any use of NamedCache API is
completely disallowed, with the only exception of asynchronous agents.
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.
SingleEntryAsynchronousProcessor| Modifier and Type | Field and Description |
|---|---|
protected Throwable |
m_eReason
Reason for the failed operation.
|
protected List<Map.Entry<K,R>> |
m_listResultEntries
List of result value entries.
|
f_processorm_control, m_iOrderId| Constructor and Description |
|---|
AsynchronousProcessor(InvocableMap.EntryProcessor<K,V,R> processor)
Construct an AsynchronousProcessor for a given processor.
|
AsynchronousProcessor(InvocableMap.EntryProcessor<K,V,R> processor,
int iUnitOrderId)
Construct an AsynchronousProcessor for a given processor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onComplete()
Called after the processor has been notified about all possible partial
results or failures and no more are forthcoming.
|
void |
onException(Throwable eReason)
Called if any part of the operation failed for any reason.
|
void |
onResult(Map.Entry<K,R> entry)
Called when there is a partial result of the asynchronous execution.
|
getProcessor, getUnitOfOrderId, process, processAllbind, cancel, checkBacklog, complete, completeExceptionally, drainBacklog, flush, get, get, getCompletableFuture, getException, getResult, isCancelled, isCompletedExceptionally, isDoneprotected volatile Throwable m_eReason
public AsynchronousProcessor(InvocableMap.EntryProcessor<K,V,R> processor)
processor - the underlying InvocableMap.EntryProcessorpublic AsynchronousProcessor(InvocableMap.EntryProcessor<K,V,R> processor, int iUnitOrderId)
processor - the underlying InvocableMap.EntryProcessoriUnitOrderId - the unit-of-order id for this processorpublic void onResult(Map.Entry<K,R> entry)
AbstractAsynchronousProcessor
For a given request, calls to this method and AbstractAsynchronousProcessor.onException(java.lang.Throwable)
may come concurrently.
For ordering guarantees across different processor invocations see
AbstractAsynchronousProcessor.getUnitOfOrderId().
Note: Overriding implementations of this method must be non-blocking.
public void onException(Throwable eReason)
AbstractAsynchronousProcessor"complete" the operation.
Note: Overriding implementations of this method must be non-blocking.
onException in class AbstractAsynchronousProcessor<K,V,R,Map<K,R>>eReason - the reason of failurepublic void onComplete()
AbstractAsynchronousProcessorInvocableMap'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
onComplete
For ordering guarantees across processors see AbstractAsynchronousProcessor.getUnitOfOrderId().
Note: Overriding implementations of this method must be non-blocking.
onComplete in class AbstractAsynchronousProcessor<K,V,R,Map<K,R>>