Java Code Examples for scala.concurrent.Await#ready()
The following examples show how to use
scala.concurrent.Await#ready() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AkkaRpcActorTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Tests that actors are properly terminated when the AkkaRpcService is shut down. */ @Test public void testActorTerminationWhenServiceShutdown() throws Exception { final ActorSystem rpcActorSystem = AkkaUtils.createDefaultActorSystem(); final RpcService rpcService = new AkkaRpcService( rpcActorSystem, AkkaRpcServiceConfiguration.defaultConfiguration()); try { SimpleRpcEndpoint rpcEndpoint = new SimpleRpcEndpoint(rpcService, SimpleRpcEndpoint.class.getSimpleName()); rpcEndpoint.start(); CompletableFuture<Void> terminationFuture = rpcEndpoint.getTerminationFuture(); rpcService.stopService(); terminationFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); } finally { rpcActorSystem.terminate(); Await.ready(rpcActorSystem.whenTerminated(), FutureUtils.toFiniteDuration(timeout)); } }
Example 2
Source File: ProcessShutDownThread.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void run() { try { Await.ready(actorSystem.whenTerminated(), terminationTimeout); } catch (Exception e) { if (e instanceof TimeoutException) { log.error("Actor system shut down timed out.", e); } else { log.error("Failure during actor system shut down.", e); } } finally { log.info("Shutdown completed. Stopping JVM."); System.exit(0); } }
Example 3
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 4
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 5
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 6
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 7
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 8
Source File: JobDeployer.java From AthenaX with Apache License 2.0 | 5 votes |
private void stopAfterJob(ClusterClient client, JobID jobID) { Preconditions.checkNotNull(jobID, "The job id must not be null"); try { Future<Object> replyFuture = client.getJobManagerGateway().ask( new ShutdownClusterAfterJob(jobID), AKKA_TIMEOUT); Await.ready(replyFuture, AKKA_TIMEOUT); } catch (Exception e) { throw new RuntimeException("Unable to tell application master to stop" + " once the specified job has been finished", e); } }
Example 9
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 10
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 11
Source File: CoffeeHouseApp.java From oreilly-reactive-architecture-student with Apache License 2.0 | 5 votes |
private void run() throws IOException, TimeoutException, InterruptedException { log.warning( String.format("{} running%nEnter commands into the terminal, e.g. 'q' or 'quit'"), getClass().getSimpleName() ); commandLoop(); Await.ready(system.whenTerminated(), Duration.Inf()); }
Example 12
Source File: QuarantineMonitorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@AfterClass public static void tearDown() throws InterruptedException, TimeoutException { if (actorSystem1 != null) { actorSystem1.terminate(); Await.ready(actorSystem1.whenTerminated(), Duration.Inf()); } }
Example 13
Source File: DefaultQuarantineHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void shutdownActorSystem(ActorSystem actorSystem) { // shut the actor system down actorSystem.terminate(); try { // give it some time to complete the shutdown Await.ready(actorSystem.whenTerminated(), timeout); } catch (InterruptedException | TimeoutException e) { log.error("Exception thrown when terminating the actor system", e); } finally { // now let's crash the JVM System.exit(exitCode); } }
Example 14
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 15
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 16
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 17
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 18
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 19
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }
Example 20
Source File: BaseAkkaTestCase.java From oreilly-reactive-architecture-student with Apache License 2.0 | 4 votes |
@After public void tearDown() throws TimeoutException, InterruptedException { Await.ready(system.terminate(), Duration.Inf()); }