+ public Future<Terminated> asyncClose() {
+ LOG.info("Shutting down ActorSystem");
+
+ final Future<Terminated> ret = actorSystem.terminate();
+ ret.onComplete(new OnComplete<Terminated>() {
+ @Override
+ public void onComplete(final Throwable failure, final Terminated success) throws Throwable {
+ if (failure != null) {
+ LOG.warn("ActorSystem failed to shut down", failure);
+ } else {
+ LOG.info("ActorSystem shut down");
+ }
+ }
+ }, ExecutionContext.global());
+ return ret;
+ }
+
+ public void close(final FiniteDuration wait) throws TimeoutException, InterruptedException {
+ Await.result(asyncClose(), wait);
+ }
+