He-Pin commented on code in PR #2096:
URL: https://github.com/apache/pekko/pull/2096#discussion_r2300285101
##########
actor/src/main/scala/org/apache/pekko/actor/ActorSystem.scala:
##########
@@ -675,7 +675,36 @@ abstract class ActorSystem extends ActorRefFactory with
ClassicActorSystemProvid
* using the dispatcher of this actor system as it will have been shut down
before the
* future completes.
*/
- def terminate(): Future[Terminated]
+ def terminate(): Unit
+
+ /**
+ * Terminates this actor system and blocks the current thread until it is
terminated,
+ * waiting at most the given duration.
+ *
+ * @param atMost the maximum duration to wait
+ * @throws java.util.concurrent.TimeoutException if the wait timed out
+ * @throws InterruptedException if the current thread is interrupted while
waiting
+ */
+ def terminateAndAwait(atMost: Duration): Unit = {
+ import scala.concurrent.Await
+ terminate()
+ Await.result(whenTerminated, atMost)
+ }
Review Comment:
Added two methods for both Java and Scala
--
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]