Class ContinuousQueryCache.ConverterAsynchronousProcessor
- All Implemented Interfaces:
FlowControl,InvocableMap.EntryProcessor,Serializable,Future
- Enclosing class:
ContinuousQueryCache<K,V_BACK, V_FRONT>
AsynchronousProcessor to ensure the result of the EntryProcessor
execution is deserialized prior to passing to the provided AsynchronousProcessor.- Since:
- 12.2.1.4
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConverterConverter to deserializeBinaryvalues.protected final AsynchronousProcessorThe delegateAsynchronousProcessor.Fields inherited from class com.tangosol.util.processor.AsynchronousProcessor
m_eReason, m_listResultEntriesFields inherited from class com.tangosol.util.AsynchronousAgent
m_control, m_iOrderId -
Constructor Summary
ConstructorsConstructorDescriptionConstruct the processor to wrap the providedAsynchronousProcessorin order to ensure results are properly converted prior to return. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(FlowControl control) Bind this agent with the specified underlying FlowControl object.booleancancel(boolean mayInterruptIfRunning) booleancheckBacklog(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.longdrainBacklog(long cMillis) Check for an excessive backlog and allow blocking the calling thread for up to the specified amount of time.voidflush()Ensure that any buffered asynchronous operations are dispatched to the underlying tier.get()Get the CompletableFuture.Helper method that returns an exception (if completed exceptionally).Obtain the underlying entry processor.Helper method that callsAsynchronousAgent.get()and re-throws checked exceptions as a RuntimeException.intReturn a unit-of-order id associated with this processor.booleanbooleanHelper method to check if the operation failed.booleanisDone()voidCalled after the processor has been notified about all possible partial results or failures and no more are forthcoming.voidonException(Throwable eReason) Called if any part of the operation failed for any reason.voidCalled when there is a partial result of the asynchronous execution.process(InvocableMap.Entry entry) Not supported.processAll(Set setEntries) Not supported.Methods inherited from class com.tangosol.util.AsynchronousAgent
complete, completeExceptionallyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
f_processor
The delegateAsynchronousProcessor. -
f_convUp
Converter to deserializeBinaryvalues.
-
-
Constructor Details
-
ConverterAsynchronousProcessor
Construct the processor to wrap the providedAsynchronousProcessorin order to ensure results are properly converted prior to return.- Parameters:
processor- the processor to wrap
-
-
Method Details
-
onResult
Description copied from class:AbstractAsynchronousProcessorCalled when there is a partial result of the asynchronous execution.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.
- Overrides:
onResultin classAsynchronousProcessor- Parameters:
entry- an entry holding the key and a result of the operation for the given key
-
onException
Description copied from class:AbstractAsynchronousProcessorCalled if any part of the operation failed for any reason. For operations that span multiple partitions this method could be called more than once. However, unless subclasses override this method, any failure will"complete"the operation.Note: Overriding implementations of this method must be non-blocking.
- Overrides:
onExceptionin classAsynchronousProcessor- Parameters:
eReason- the reason of failure
-
onComplete
public void onComplete()Description copied from class:AbstractAsynchronousProcessorCalled after the processor has been notified about all possible partial results or failures and no more are forthcoming. As long as this processor was submitted to any ofInvocableMap'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 seeAbstractAsynchronousProcessor.getUnitOfOrderId().Note: Overriding implementations of this method must be non-blocking.
- Overrides:
onCompletein classAsynchronousProcessor
-
getUnitOfOrderId
public int getUnitOfOrderId()Description copied from class:AbstractAsynchronousProcessorReturn a unit-of-order id associated with this processor. By default, the unit-of-order id is assigned to the calling thread's hashCode.If two consecutive "invoke" calls are made using
AsynchronousProcessorswith the same order id and the same key set, then the correspondingexecutionand calls toAbstractAsynchronousProcessor.onResult(java.util.Map.Entry<K, R>)are going to happen in the exact same order.If two consecutive "invoke" calls are made using
AsynchronousProcessorswith the same order id and the same partition set, then the the correspondingexecutionand calls toAbstractAsynchronousProcessor.onComplete()are going to happen in the exact same order.Note 1: The ordering guarantee is respected between
AsynchronousProcessorsandAsynchronousAggregators with the same unit-of-order id.
Note 2: There is no ordering guarantees between asynchronous and synchronous operations.- Overrides:
getUnitOfOrderIdin classAbstractAsynchronousProcessor- Returns:
- the unit-of-order id associated with this processor
- See Also:
-
getProcessor
Description copied from class:AbstractAsynchronousProcessorObtain the underlying entry processor.- Overrides:
getProcessorin classAbstractAsynchronousProcessor- Returns:
- the underlying entry processor
-
process
Description copied from class:AbstractAsynchronousProcessorNot supported.- Specified by:
processin interfaceInvocableMap.EntryProcessor- Overrides:
processin classAbstractAsynchronousProcessor- Parameters:
entry- the Entry to process- Returns:
- the result of the processing, if any
-
processAll
Description copied from class:AbstractAsynchronousProcessorNot supported.- Specified by:
processAllin interfaceInvocableMap.EntryProcessor- Overrides:
processAllin classAbstractAsynchronousProcessor- Parameters:
setEntries- a Set of InvocableMap.Entry objects to process- Returns:
- a Map containing the results of the processing, up to one entry for each InvocableMap.Entry that was processed, keyed by the keys of the Map that were processed, with a corresponding value being the result of the processing for each key
-
bind
Description copied from class:AsynchronousAgentBind this agent with the specified underlying FlowControl object. This method is to be used only internally by the service.- Overrides:
bindin classAsynchronousAgent- Parameters:
control- the underlying FlowControl
-
flush
public void flush()Description copied from interface:FlowControlEnsure that any buffered asynchronous operations are dispatched to the underlying tier.Note: this is a non-blocking call.
- Specified by:
flushin interfaceFlowControl- Overrides:
flushin classAsynchronousAgent
-
checkBacklog
Description copied from interface:FlowControlCheck 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. It's important to remember that:- The continuation could be called on any thread; concurrently with the calling thread or on the calling thread itself.
- The continuation is called if and only if this method returns
true. - The continuation must not make any blocking calls.
- Specified by:
checkBacklogin interfaceFlowControl- Overrides:
checkBacklogin classAsynchronousAgent- Parameters:
continueNormal- (optional)Continuationto be called when the backlog has been reduced back to normal- Returns:
- true if the underlying communication channel is backlogged; false otherwise
-
drainBacklog
public long drainBacklog(long cMillis) Description copied from interface:FlowControlCheck for an excessive backlog and allow blocking the calling thread for up to the specified amount of time.- Specified by:
drainBacklogin interfaceFlowControl- Overrides:
drainBacklogin classAsynchronousAgent- Parameters:
cMillis- the maximum amount of time to wait (in milliseconds), or zero for infinite wait- Returns:
- the remaining timeout or a negative value if timeout has occurred (the return of zero is only allowed for infinite timeout and indicates that the backlog is no longer excessive)
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) - Specified by:
cancelin interfaceFuture- Overrides:
cancelin classAsynchronousAgent
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture- Overrides:
isCancelledin classAsynchronousAgent
-
isDone
public boolean isDone()- Specified by:
isDonein interfaceFuture- Overrides:
isDonein classAsynchronousAgent
-
get
- Specified by:
getin interfaceFuture- Overrides:
getin classAsynchronousAgent- Throws:
InterruptedExceptionExecutionException
-
get
public Object get(long cTimeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture- Overrides:
getin classAsynchronousAgent- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
getResult
Description copied from class:AsynchronousAgentHelper method that callsAsynchronousAgent.get()and re-throws checked exceptions as a RuntimeException.- Overrides:
getResultin classAsynchronousAgent- Returns:
- the result value
-
getException
Description copied from class:AsynchronousAgentHelper method that returns an exception (if completed exceptionally).- Overrides:
getExceptionin classAsynchronousAgent- Returns:
- the exception or null if the operation completed successfully
-
isCompletedExceptionally
public boolean isCompletedExceptionally()Description copied from class:AsynchronousAgentHelper method to check if the operation failed.- Overrides:
isCompletedExceptionallyin classAsynchronousAgent- Returns:
- true if the operation failed
-
getCompletableFuture
Description copied from class:AsynchronousAgentGet the CompletableFuture.- Overrides:
getCompletableFuturein classAsynchronousAgent- Returns:
- CompletableFuture
-