Modifier and Type | Method and Description |
---|---|
CoreAsync |
build() |
CoreAsync.Builder |
caller(Caller caller)
Specify an asynchronous caller implementation.
|
CoreAsync.Builder |
callerExecutor(ExecutorService callerExecutor)
Specify a separate executor to use for caller (internal handle) invocation.
|
CoreAsync.Builder |
clockSource(ClockSource clockSource)
Configure clock source.
|
CoreAsync.Builder |
executor(ExecutorService executor)
Configure the default executor to use for caller invocation,and asynchronous tasks submitted
through
Async.call(Callable) . |
CoreAsync.Builder |
managedOptions(ManagedOptions managedOptions) |
CoreAsync.Builder |
maxRecursionDepth(long maxRecursionDepth)
Configure how many recursions should be allowed.
|
CoreAsync.Builder |
recursionSafe(boolean recursionSafe)
Configure that all caller invocations should use a recursion safe mechanism.
|
CoreAsync.Builder |
scheduler(ScheduledExecutorService scheduler)
Specify a scheduler to use with the built CoreAsync instance.
|
CoreAsync.Builder |
threaded(boolean threaded)
Configure that all caller invocation, and async tasks should be using a thread pool.
|
public CoreAsync.Builder threaded(boolean threaded)
This will cause the configuration of TinyTask to throw an exception if an executor service is not available for all purposes.
threaded
- true
if all tasks should be executed on a thread poolpublic CoreAsync.Builder recursionSafe(boolean recursionSafe)
Recursion is tracked for all threads that doCall the AsyncCallers.
This will make even the non-threaded caller use a thread in the case of deep recursion.
recursionSafe
- true
if all caller invocations should be done with a recursion
safe mechanism.public CoreAsync.Builder maxRecursionDepth(long maxRecursionDepth)
This implies enabling recursionSafe
.
maxRecursionDepth
- The max number of times that a caller may go through Caller
in a single thread.public CoreAsync.Builder caller(Caller caller)
The 'caller' defines how handles are invoked. The simplest implementations are based of
DirectCaller
, which causes the doCall to be performed directly in the calling
thread.
caller
- caller to configurepublic CoreAsync.Builder executor(ExecutorService executor)
Async.call(Callable)
.executor
- Executor to usepublic CoreAsync.Builder callerExecutor(ExecutorService callerExecutor)
Implies use of threaded caller.
callerExecutor
- Executor to use for callerspublic CoreAsync.Builder scheduler(ScheduledExecutorService scheduler)
scheduler
- The scheduler to usepublic CoreAsync.Builder clockSource(ClockSource clockSource)
A clock source is used to determine what the current time is in order to do timing-related tasks like retrying an action until it has been completed with a back-off.
clockSource
- clock source to configureAsync.retryUntilCompleted(java.util.concurrent.Callable, RetryPolicy)
public CoreAsync.Builder managedOptions(ManagedOptions managedOptions)
public CoreAsync build()
Copyright © 2017. All rights reserved.