protected class ContinuousQueryCache.ConverterAsynchronousProcessor extends AsynchronousProcessor
AsynchronousProcessor
to ensure the result of the EntryProcessor
execution is deserialized prior to passing to the provided AsynchronousProcessor.Modifier and Type | Field and Description |
---|---|
protected Converter |
f_convUp
Converter to deserialize
Binary values. |
protected AsynchronousProcessor |
f_processor
The delegate
AsynchronousProcessor . |
m_eReason, m_listResultEntries
m_control, m_iOrderId
Constructor and Description |
---|
ConverterAsynchronousProcessor(AsynchronousProcessor processor)
Construct the processor to wrap the provided
AsynchronousProcessor in order to
ensure results are properly converted prior to return. |
Modifier and Type | Method and Description |
---|---|
void |
bind(FlowControl control)
Bind this agent with the specified underlying FlowControl object.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
checkBacklog(com.oracle.coherence.common.base.Continuation continueNormal)
Check for an excessive backlog and if the underlying communication channel
is indeed clogged, call the specified continuation when the backlog is
back to normal or the service terminates.
|
long |
drainBacklog(long cMillis)
Check for an excessive backlog and allow blocking the calling thread for
up to the specified amount of time.
|
void |
flush()
Ensure that any buffered asynchronous operations are dispatched to the
underlying tier.
|
Object |
get() |
Object |
get(long cTimeout,
TimeUnit unit) |
CompletableFuture |
getCompletableFuture()
Get the CompletableFuture.
|
Throwable |
getException()
Helper method that returns an exception (if completed exceptionally).
|
InvocableMap.EntryProcessor |
getProcessor()
Obtain the underlying entry processor.
|
Object |
getResult()
Helper method that calls
AsynchronousAgent.get() and re-throws checked exceptions
as a RuntimeException. |
int |
getUnitOfOrderId()
Return a unit-of-order id associated with this processor.
|
boolean |
isCancelled() |
boolean |
isCompletedExceptionally()
Helper method to check if the operation failed.
|
boolean |
isDone() |
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 entry)
Called when there is a partial result of the asynchronous execution.
|
Object |
process(InvocableMap.Entry entry)
Not supported.
|
Map |
processAll(Set setEntries)
Not supported.
|
complete, completeExceptionally
protected final AsynchronousProcessor f_processor
AsynchronousProcessor
.public ConverterAsynchronousProcessor(AsynchronousProcessor processor)
AsynchronousProcessor
in order to
ensure results are properly converted prior to return.processor
- the processor to wrappublic void onResult(Map.Entry 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.
onResult
in class AsynchronousProcessor
entry
- an entry holding the key and a result of the operation for
the given keypublic void onException(Throwable eReason)
AbstractAsynchronousProcessor
"complete"
the operation.
Note: Overriding implementations of this method must be non-blocking.
onException
in class AsynchronousProcessor
eReason
- the reason of failurepublic void onComplete()
AbstractAsynchronousProcessor
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
AbstractAsynchronousProcessor.getUnitOfOrderId()
.
Note: Overriding implementations of this method must be non-blocking.
onComplete
in class AsynchronousProcessor
public int getUnitOfOrderId()
AbstractAsynchronousProcessor
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 AbstractAsynchronousProcessor.onResult(java.util.Map.Entry<K, R>)
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 AbstractAsynchronousProcessor.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.
getUnitOfOrderId
in class AbstractAsynchronousProcessor
AbstractAsynchronousAggregator.getUnitOfOrderId()
,
AbstractAsynchronousProcessor.getUnitOfOrderId()
public InvocableMap.EntryProcessor getProcessor()
AbstractAsynchronousProcessor
getProcessor
in class AbstractAsynchronousProcessor
public Object process(InvocableMap.Entry entry)
AbstractAsynchronousProcessor
process
in interface InvocableMap.EntryProcessor
process
in class AbstractAsynchronousProcessor
entry
- the Entry to processpublic Map processAll(Set setEntries)
AbstractAsynchronousProcessor
processAll
in interface InvocableMap.EntryProcessor
processAll
in class AbstractAsynchronousProcessor
setEntries
- a Set of InvocableMap.Entry objects to processpublic void bind(FlowControl control)
AsynchronousAgent
bind
in class AsynchronousAgent
control
- the underlying FlowControlpublic void flush()
FlowControl
Note: this is a non-blocking call.
flush
in interface FlowControl
flush
in class AsynchronousAgent
public boolean checkBacklog(com.oracle.coherence.common.base.Continuation continueNormal)
FlowControl
true
.
checkBacklog
in interface FlowControl
checkBacklog
in class AsynchronousAgent
continueNormal
- (optional) Continuation
to be called when
the backlog has been reduced back to normalpublic long drainBacklog(long cMillis)
FlowControl
drainBacklog
in interface FlowControl
drainBacklog
in class AsynchronousAgent
cMillis
- the maximum amount of time to wait (in milliseconds), or
zero for infinite waitpublic boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface Future
cancel
in class AsynchronousAgent
public boolean isCancelled()
isCancelled
in interface Future
isCancelled
in class AsynchronousAgent
public boolean isDone()
isDone
in interface Future
isDone
in class AsynchronousAgent
public Object get() throws InterruptedException, ExecutionException
get
in interface Future
get
in class AsynchronousAgent
InterruptedException
ExecutionException
public Object get(long cTimeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future
get
in class AsynchronousAgent
InterruptedException
ExecutionException
TimeoutException
public Object getResult()
AsynchronousAgent
AsynchronousAgent.get()
and re-throws checked exceptions
as a RuntimeException.getResult
in class AsynchronousAgent
public Throwable getException()
AsynchronousAgent
getException
in class AsynchronousAgent
public boolean isCompletedExceptionally()
AsynchronousAgent
isCompletedExceptionally
in class AsynchronousAgent
public CompletableFuture getCompletableFuture()
AsynchronousAgent
getCompletableFuture
in class AsynchronousAgent