public class ActorControl extends Object
| Constructor and Description |
|---|
ActorControl(Actor actor) |
| Modifier and Type | Method and Description |
|---|---|
<T> ActorFuture<T> |
call(Callable<T> callable)
Callables actions are called while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED |
ActorFuture<Void> |
call(Runnable action)
Callables actions are called while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED |
ActorFuture<Void> |
close() |
ChannelSubscription |
consume(ConsumableChannel channel,
Runnable consumer)
Consumers are called while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED |
void |
done() |
ActorTask.ActorLifecyclePhase |
getLifecyclePhase() |
boolean |
isCalledFromWithinActor(ActorJob job) |
boolean |
isClosing() |
ActorCondition |
onCondition(String conditionName,
Runnable conditionAction)
Conditional actions are called while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED |
void |
pollBlocking(Runnable condition,
Runnable action) |
void |
run(Runnable action)
Runnables submitted by the actor itself are executed while the actor is in any of its lifecycle
phases.
|
ScheduledTimer |
runAtFixedRate(java.time.Duration delay,
Runnable runnable)
Scheduled a repeating timer
|
void |
runBlocking(Runnable runnable)
run a blocking task
|
void |
runBlocking(Runnable runnable,
java.util.function.Consumer<Throwable> completionConsumer)
The provided runnable is executed in any of the actor's lifecycle phases.
|
ScheduledTimer |
runDelayed(java.time.Duration delay,
Runnable runnable)
The runnable is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED |
<T> void |
runOnCompletion(ActorFuture<T> future,
java.util.function.BiConsumer<T,Throwable> callback)
Invoke the callback when the given future is completed (successfully or exceptionally).
|
<T> void |
runOnCompletion(Collection<ActorFuture<T>> futures,
java.util.function.Consumer<Throwable> callback)
Invoke the callback when the given futures are completed (successfully or exceptionally).
|
<T> void |
runOnCompletionBlockingCurrentPhase(ActorFuture<T> future,
java.util.function.BiConsumer<T,Throwable> callback)
Invoke the callback when the given future is completed (successfully or exceptionally).
|
<T> void |
runOnFirstCompletion(Collection<ActorFuture<T>> futures,
java.util.function.BiConsumer<T,Throwable> callback)
Invoke the callback when the first future is completed successfully, or when all futures are
completed exceptionally.
|
<T> void |
runOnFirstCompletion(Collection<ActorFuture<T>> futures,
java.util.function.BiConsumer<T,Throwable> callback,
java.util.function.Consumer<T> closer)
Invoke the callback when the first future is completed successfully, or when all futures are
completed exceptionally.
|
void |
runUntilDone(Runnable runnable)
Run the provided runnable repeatedly until it calls
done(). |
void |
setPriority(ActorPriority priority) |
void |
setSchedulingHints(int hints)
changes the actor's scheduling hints.
|
void |
submit(Runnable action)
Like
run(Runnable) but submits the runnable to the end end of the actor's queue such
that other other actions may be executed before this. |
void |
yield()
can be called by the actor to yield the thread
|
public ActorControl(Actor actor)
public void setSchedulingHints(int hints)
hints - the changed scheduling hintspublic ChannelSubscription consume(ConsumableChannel channel, Runnable consumer)
ActorTask.ActorLifecyclePhase.STARTEDchannel - consumer - public ActorCondition onCondition(String conditionName, Runnable conditionAction)
ActorTask.ActorLifecyclePhase.STARTEDconditionName - conditionAction - public <T> ActorFuture<T> call(Callable<T> callable)
ActorTask.ActorLifecyclePhase.STARTEDcallable - public ActorFuture<Void> call(Runnable action)
ActorTask.ActorLifecyclePhase.STARTEDaction - public void run(Runnable action)
Runnables submitted externally are executed while the actor is in the following actor
lifecycle phases: ActorTask.ActorLifecyclePhase.STARTED
action - public void runBlocking(Runnable runnable)
The provided runnable is executed in any of the actor's lifecycle phases.
public void runBlocking(Runnable runnable, java.util.function.Consumer<Throwable> completionConsumer)
ActorTask.ActorLifecyclePhase.STARTED.runnable - completionConsumer - public void runUntilDone(Runnable runnable)
done(). To be used for jobs which
may experience backpressure.public ScheduledTimer runDelayed(java.time.Duration delay, Runnable runnable)
ActorTask.ActorLifecyclePhase.STARTEDdelay - runnable - public void submit(Runnable action)
run(Runnable) but submits the runnable to the end end of the actor's queue such
that other other actions may be executed before this. This method is useful in case an actor is
in a (potentially endless) loop and it should be able to interrupt it.
The runnable is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
action - the action to run.public ScheduledTimer runAtFixedRate(java.time.Duration delay, Runnable runnable)
The runnable is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
delay - runnable - public <T> void runOnCompletion(ActorFuture<T> future, java.util.function.BiConsumer<T,Throwable> callback)
The callback is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
future - the future to wait oncallback - the callback that handle the future's result. The throwable is null
when the future is completed successfully.public <T> void runOnCompletionBlockingCurrentPhase(ActorFuture<T> future, java.util.function.BiConsumer<T,Throwable> callback)
The callback is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
future - the future to wait oncallback - the callback that handle the future's result. The throwable is null
when the future is completed successfully.public <T> void runOnCompletion(Collection<ActorFuture<T>> futures, java.util.function.Consumer<Throwable> callback)
The callback is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
futures - the futures to wait oncallback - The throwable is null when all futures are completed successfully.
Otherwise, it holds the exception of the last completed future.public <T> void runOnFirstCompletion(Collection<ActorFuture<T>> futures, java.util.function.BiConsumer<T,Throwable> callback)
The callback is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
futures - the futures to wait oncallback - the callback that handle the future's result. The throwable is null
when the first future is completed successfully. Otherwise, it holds the exception
of the last completed future.public <T> void runOnFirstCompletion(Collection<ActorFuture<T>> futures, java.util.function.BiConsumer<T,Throwable> callback, java.util.function.Consumer<T> closer)
The callback is is executed while the actor is in the following actor lifecycle phases:
ActorTask.ActorLifecyclePhase.STARTED
futures - the futures to wait oncallback - the callback that handle the future's result. The throwable is null
when the first future is completed successfully. Otherwise, it holds the exception
of the last completed future.closer - the callback that is invoked when a future is completed after the first future is
completedpublic void yield()
public ActorFuture<Void> close()
public void done()
public boolean isClosing()
public void setPriority(ActorPriority priority)
public ActorTask.ActorLifecyclePhase getLifecyclePhase()
public boolean isCalledFromWithinActor(ActorJob job)
Copyright © 2017–2019 camunda services GmbH. All rights reserved.