@Override public void close() throws Exception { if (isLoaded()) { actorSystem.terminate(); Await.ready(actorSystem.whenTerminated(), Duration.Inf()); actorSystem = null; } }
/** * Remove all event listeners, stop ioRouter and opsActor actors and terminate actor system. */ @PreDestroy public void preDestroy() { context.getEventService().removeListener(eventListener); akka.stop(ioRouter); akka.stop(opsActor); akka.terminate(); }
@After public void shutDownActorSystem() { if (jobManagerSystem != null) { try { jobManagerSystem.terminate(); Await.ready(jobManagerSystem.whenTerminated(), Duration.Inf()); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } }
actorSystem.terminate().onComplete( new OnComplete<Terminated>() { public void onComplete(Throwable failure, Terminated result) {
system.terminate(); Await.ready(system.whenTerminated(), Duration.Inf());
@Override public void onComplete(Throwable throwable, Iterable<Integer> integers) throws Throwable { System.out.println("countAgent 3:" + countAgent.get()); system.terminate(); } }, system.dispatcher());
public void close() throws IOException { try { client.close(); } finally { system.terminate(); } } };
@Override public void close() { LOG.info("Shutting down ActorSystem"); try { Await.result(actorSystem.terminate(), Duration.create(10, TimeUnit.SECONDS)); } catch (Exception e) { LOG.warn("Error awaiting actor termination", e); } } }
@Override public void terminate() throws Exception { Await.result(actorSystem.terminate(), Duration.Inf()); } }
public void close() throws IOException { try { try { client.close(); } finally { final Future<Terminated> terminate = system.terminate(); Await.result(terminate, Duration.Inf()); } } catch (Exception e) { throw new IOException(e); } }
@Override public void close() { LOG.info("Closing source"); if (receiverActorSystem != null) { receiverActor.tell(PoisonPill.getInstance(), ActorRef.noSender()); receiverActorSystem.terminate(); } }
public void close() throws IOException { try { try { client.close(); } finally { final Future<Terminated> terminate = system.terminate(); Await.result(terminate, Duration.Inf()); } } catch (Exception e) { throw new IOException(e); } }
public void close() throws IOException { try { try { client.close(); } finally { final Future<Terminated> terminate = system.terminate(); Await.result(terminate, Duration.Inf()); } } catch (Exception e) { throw new IOException(e); } }
@AfterClass public static void tearDown() { if (actorSystem != null) { actorSystem.terminate(); actorSystem = null; } }
@Override public void close() throws Exception { if (isLoaded()) { actorSystem.terminate(); Await.ready(actorSystem.whenTerminated(), Duration.Inf()); actorSystem = null; } }
public static void main(String... args) throws Exception { final ActorSystem system = ActorSystem.create("example"); final ActorRef persistentActor = system.actorOf(Props.create(ExamplePersistentActor.class), "persistentActor-3-java"); persistentActor.tell("a", null); persistentActor.tell("b", null); persistentActor.tell("snap", null); persistentActor.tell("c", null); persistentActor.tell("d", null); persistentActor.tell("print", null); Thread.sleep(10000); system.terminate(); } }
@Override public Receive createReceive() { return receiveBuilder() .match(Terminated.class, t -> { log().info("{} has terminated, shutting down system", ref.path()); getContext().system().terminate(); }) .build(); } }
@AfterEach public void afterTest() throws Exception { feederActorSystem.terminate(); Await.result(feederActorSystem.whenTerminated(), Duration.Inf()); source.cancel(); sourceThread.join(); }
public static void main(String... args) throws Exception { final ActorSystem system = ActorSystem.create("example"); final ActorRef persistentActor = system.actorOf(Props.create(ExamplePersistentActor.class), "persistentActor-4-java8"); persistentActor.tell(new Cmd("foo"), null); persistentActor.tell(new Cmd("baz"), null); persistentActor.tell(new Cmd("bar"), null); persistentActor.tell("snap", null); persistentActor.tell(new Cmd("buzz"), null); persistentActor.tell("print", null); Thread.sleep(10000); system.terminate(); } }
public static void main(String[] args) { ActorSystem actorSystem = ActorSystem.create("modelBasedActorSystem"); ModelRunner modelRunner = runnerOf(model()); ActorRef sayHelloActor = spawn("sayHelloActor", actorSystem, SayHelloActor.class, modelRunner); sayHelloActor.tell(new AsksForHelloWorld(), ActorRef.noSender()); sayHelloActor.tell(new AsksForHelloToUser("Sandra"), ActorRef.noSender()); waitForReturnKeyPressed(); actorSystem.terminate(); }