clarify ExecutionContext for whenTerminated operations (#28537)

This commit is contained in:
Patrik Nordwall 2020-01-29 11:47:18 +01:00 committed by GitHub
parent 3c24fa7dee
commit 45ed6eabca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View file

@ -116,9 +116,12 @@ abstract class ActorSystem[-T] extends ActorRef[T] with Extensions with ClassicA
def terminate(): Unit
/**
* Scala API: Returns a Future which will be completed after the ActorSystem has been terminated
* and termination hooks have been executed. The `ActorSystem` can be stopped with [[ActorSystem.terminate]]
* Scala API: Returns a Future which will be completed after the ActorSystem has been terminated.
* The `ActorSystem` can be stopped with [[ActorSystem.terminate]]
* or by stopping the guardian actor.
*
* Be careful to not schedule any operations, such as `onComplete`, on the dispatchers (`ExecutionContext`)
* of this actor system as they will have been shut down before this future completes.
*/
def whenTerminated: Future[Done]
@ -126,6 +129,9 @@ abstract class ActorSystem[-T] extends ActorRef[T] with Extensions with ClassicA
* Java API: Returns a CompletionStage which will be completed after the ActorSystem has been terminated
* and termination hooks have been executed. The `ActorSystem` can be stopped with [[ActorSystem.terminate]]
* or by stopping the guardian actor.
*
* Be careful to not schedule any operations, such as `thenRunAsync`, on the dispatchers (`Executor`) of this
* actor system as they will have been shut down before this CompletionStage completes.
*/
def getWhenTerminated: CompletionStage[Done]

View file

@ -684,9 +684,9 @@ abstract class ActorSystem extends ActorRefFactory with ClassicActorSystemProvid
* Returns a Future which will be completed after the ActorSystem has been terminated
* and termination hooks have been executed. If you registered any callback with
* [[ActorSystem#registerOnTermination]], the returned Future from this method will not complete
* until all the registered callbacks are finished. Be careful to not schedule any operations
* on the `dispatcher` of this actor system as it will have been shut down before this
* future completes.
* until all the registered callbacks are finished. Be careful to not schedule any operations,
* such as `onComplete`, on the dispatchers (`ExecutionContext`) of this actor system as they
* will have been shut down before this future completes.
*/
def whenTerminated: Future[Terminated]
@ -694,9 +694,9 @@ abstract class ActorSystem extends ActorRefFactory with ClassicActorSystemProvid
* Returns a CompletionStage which will be completed after the ActorSystem has been terminated
* and termination hooks have been executed. If you registered any callback with
* [[ActorSystem#registerOnTermination]], the returned CompletionStage from this method will not complete
* until all the registered callbacks are finished. Be careful to not schedule any operations
* on the `dispatcher` of this actor system as it will have been shut down before this
* future completes.
* until all the registered callbacks are finished. Be careful to not schedule any operations,
* such as `thenRunAsync`, on the dispatchers (`Executor`) of this actor system as they
* will have been shut down before this CompletionStage completes.
*/
def getWhenTerminated: CompletionStage[Terminated]