Class ContinuationService<T>
- java.lang.Object
-
- com.oracle.coherence.concurrent.executor.ContinuationService<T>
-
- Type Parameters:
T- a type
public class ContinuationService<T> extends Object
A service for tracking, composing and executingComposableContinuations.- Since:
- 21.12
- Author:
- Brian Oliver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classContinuationService.ContinuationRunnableTheRunnablethat will execute aComposableContinuationfor anObjectusing a specifiedExecutorServiceindex.
-
Field Summary
Fields Modifier and Type Field Description protected ExecutorService[]f_aContinuationServicesTheExecutorServices for executingComposableContinuations.protected ConcurrentHashMap<T,ComposableContinuation>f_mapPendingContinuationsThe map of pendingComposableContinuations by object.protected AtomicEnum<com.oracle.coherence.concurrent.executor.ContinuationService.State>f_stateThe currentContinuationService.Stateof theContinuationService.
-
Constructor Summary
Constructors Constructor Description ContinuationService(ThreadFactory threadFactory)Construct aContinuationServiceusing the specifiedThreadFactoryto provideThreads for executingComposableContinuations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabandon(T object)Abandons anyComposableContinuations for the specified object.voidshutdown()Initiates an orderly shutdown in which previously submittedComposableContinuations are allowed to execute, but no newComposableContinuations may be executed.voidshutdownNow()Attempts the shutdown of theContinuationServiceimmediately, abandoning any submittedComposableContinuations and interrupting those that are running.booleansubmit(ComposableContinuation continuation, T object)Schedule aComposableContinuationto be asynchronously executed for the specified object.
-
-
-
Field Detail
-
f_mapPendingContinuations
protected final ConcurrentHashMap<T,ComposableContinuation> f_mapPendingContinuations
The map of pendingComposableContinuations by object.
-
f_aContinuationServices
protected final ExecutorService[] f_aContinuationServices
TheExecutorServices for executingComposableContinuations.
-
f_state
protected final AtomicEnum<com.oracle.coherence.concurrent.executor.ContinuationService.State> f_state
The currentContinuationService.Stateof theContinuationService.
-
-
Constructor Detail
-
ContinuationService
public ContinuationService(ThreadFactory threadFactory)
Construct aContinuationServiceusing the specifiedThreadFactoryto provideThreads for executingComposableContinuations.- Parameters:
threadFactory- theThreadFactory
-
-
Method Detail
-
submit
public boolean submit(ComposableContinuation continuation, T object)
Schedule aComposableContinuationto be asynchronously executed for the specified object.- Parameters:
continuation- theComposableContinuationobject- the object- Returns:
trueif theComposableContinuationwas acceptedfalseif theComposableContinuationwas rejected (due to the service being unavailable or the continuation being invalid ie:null)
-
abandon
public void abandon(T object)
Abandons anyComposableContinuations for the specified object.- Parameters:
object- the object
-
shutdown
public void shutdown()
Initiates an orderly shutdown in which previously submittedComposableContinuations are allowed to execute, but no newComposableContinuations may be executed.This method does not wait for previously submitted tasks to complete execution. Use awaitTermination to do that.
-
shutdownNow
public void shutdownNow()
Attempts the shutdown of theContinuationServiceimmediately, abandoning any submittedComposableContinuations and interrupting those that are running.This method does not wait for previously submitted tasks to complete execution. Use awaitTermination to do that.
-
-