mdedetrich commented on code in PR #2479:
URL: https://github.com/apache/pekko/pull/2479#discussion_r2517401137
##########
actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala:
##########
@@ -697,7 +713,56 @@ abstract class ActorSystem extends ActorRefFactory with
ClassicActorSystemProvid
* 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]
+ @deprecated(
+ "Use the .getWhenTerminated() function on an ActorSystem created by
org.apache.pekko.actor.javadsl.ActorSystem.create",
+ "1.3.0")
+ def getWhenTerminated: CompletionStage[Terminated] =
whenTerminatedImpl.asJava
+
+ /**
+ * Terminates this actor system by running [[CoordinatedShutdown]] with
reason
+ * [[CoordinatedShutdown.ActorSystemTerminateReason]]. This method will block
+ * until either the actor system is terminated or
+ * `pekko.coordinated-shutdown.close-actor-system-timeout` timeout duration
is
+ * passed, in which case a [[TimeoutException]] is thrown.
+ *
+ * If `pekko.coordinated-shutdown.run-by-actor-system-terminate` is
configured to `off`
+ * it will not run `CoordinatedShutdown`, but the `ActorSystem` and its
actors
+ * will still be terminated.
+ *
+ * This will stop the guardian actor, which in turn
+ * will recursively stop all its child actors, and finally the system
guardian
+ * (below which the logging actors reside) and then execute all registered
+ * termination handlers (see [[ActorSystem#registerOnTermination]]).
+ * @since 1.3.0
+ */
+ @throws(classOf[TimeoutException])
+ override def close(): Unit = {
+ terminateImpl()
+ Await.ready(whenTerminatedImpl,
+
Duration(settings.config.getDuration("coordinated-shutdown.close-actor-system-timeout").toMillis,
+ TimeUnit.MILLISECONDS))
+ }
+
+ /**
+ * Asynchronously terminates this actor system by running
[[CoordinatedShutdown]] with reason
+ * [[CoordinatedShutdown.ActorSystemTerminateReason]]. This method will block
+ * until either the actor system is terminated or
+ * `pekko.coordinated-shutdown.close-actor-system-timeout` timeout duration
is
+ * passed, in which case a [[TimeoutException]] is thrown.
Review Comment:
It is
https://github.com/apache/pekko/blob/2ed0aea6f18b0cec5ecbd5e4118d2cc2c9b43c42/actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala#L738
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]