Added actor termination coordinated shutdown task #27089
A convenience method that allows creating a shutdown task by sending a message to an actor, and watching for its termination.
This commit is contained in:
parent
d3170a56ea
commit
511356177d
5 changed files with 195 additions and 2 deletions
|
|
@ -875,4 +875,18 @@ public class ActorDocTest extends AbstractJavaTest {
|
|||
// #coordinated-shutdown-run
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void coordinatedShutdownActorTermination() {
|
||||
ActorRef someActor = system.actorOf(Props.create(FirstActor.class));
|
||||
someActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
|
||||
// #coordinated-shutdown-addActorTerminationTask
|
||||
CoordinatedShutdown.get(system)
|
||||
.addActorTerminationTask(
|
||||
CoordinatedShutdown.PhaseBeforeServiceUnbind(),
|
||||
"someTaskName",
|
||||
someActor,
|
||||
Optional.of("stop"));
|
||||
// #coordinated-shutdown-addActorTerminationTask
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue