本文整理了Java中scala.concurrent.Await.ready()
方法的一些代码示例,展示了Await.ready()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Await.ready()
方法的具体详情如下:
包路径:scala.concurrent.Await
类名称:Await
方法名:ready
暂无
代码示例来源:origin: apache/flink
@Override
public void shutDownCluster() {
LOG.info("Sending shutdown request to the Application Master");
try {
final Future<Object> response = Patterns.ask(applicationClient.get(),
new YarnMessages.LocalStopYarnSession(ApplicationStatus.SUCCEEDED,
"Flink YARN Client requested shutdown"),
new Timeout(akkaDuration));
Await.ready(response, akkaDuration);
} catch (final Exception e) {
LOG.warn("Error while stopping YARN cluster.", e);
}
}
代码示例来源:origin: apache/flink
private void stopAfterJob(JobID jobID) {
Preconditions.checkNotNull(jobID, "The job id must not be null");
try {
Future<Object> replyFuture =
getJobManagerGateway().ask(
new ShutdownClusterAfterJob(jobID),
akkaDuration);
Await.ready(replyFuture, akkaDuration);
} catch (Exception e) {
throw new RuntimeException("Unable to tell application master to stop once the specified job has been finised", e);
}
}
代码示例来源:origin: apache/flink
@Override
public void close() throws Exception {
if (isLoaded()) {
actorSystem.terminate();
Await.ready(actorSystem.whenTerminated(), Duration.Inf());
actorSystem = null;
}
}
代码示例来源:origin: apache/flink
@After
public void shutDownActorSystem() {
if (jobManagerSystem != null) {
try {
jobManagerSystem.terminate();
Await.ready(jobManagerSystem.whenTerminated(), Duration.Inf());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
}
代码示例来源:origin: apache/flink
Await.ready(actorSystem.whenTerminated(), Duration.Inf());
} catch (InterruptedException | TimeoutException e) {
LOG.error("Error shutting down actor system", e);
代码示例来源:origin: apache/flink
Await.ready(taskManagerRegisteredFuture, deadline.timeLeft());
代码示例来源:origin: apache/flink
Future<Object> future = jm.ask(new WaitForAllVerticesToBeRunningOrFinished(graph.getJobID()), deadline.timeLeft());
Await.ready(future, deadline.timeLeft());
代码示例来源:origin: apache/flink
Await.ready(system.whenTerminated(), Duration.Inf());
代码示例来源:origin: uber/AthenaX
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);
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
@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);
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
@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);
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
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);
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
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);
}
}
}
代码示例来源:origin: org.apache.flink/flink-yarn_2.11
@Override
public void shutDownCluster() {
LOG.info("Sending shutdown request to the Application Master");
try {
final Future<Object> response = Patterns.ask(applicationClient.get(),
new YarnMessages.LocalStopYarnSession(ApplicationStatus.SUCCEEDED,
"Flink YARN Client requested shutdown"),
new Timeout(akkaDuration));
Await.ready(response, akkaDuration);
} catch (final Exception e) {
LOG.warn("Error while stopping YARN cluster.", e);
}
}
代码示例来源:origin: org.apache.flink/flink-yarn
@Override
public void shutDownCluster() {
LOG.info("Sending shutdown request to the Application Master");
try {
final Future<Object> response = Patterns.ask(applicationClient.get(),
new YarnMessages.LocalStopYarnSession(ApplicationStatus.SUCCEEDED,
"Flink YARN Client requested shutdown"),
new Timeout(akkaDuration));
Await.ready(response, akkaDuration);
} catch (final Exception e) {
LOG.warn("Error while stopping YARN cluster.", e);
}
}
代码示例来源:origin: org.apache.flink/flink-yarn_2.11
private void stopAfterJob(JobID jobID) {
Preconditions.checkNotNull(jobID, "The job id must not be null");
try {
Future<Object> replyFuture =
getJobManagerGateway().ask(
new ShutdownClusterAfterJob(jobID),
akkaDuration);
Await.ready(replyFuture, akkaDuration);
} catch (Exception e) {
throw new RuntimeException("Unable to tell application master to stop once the specified job has been finised", e);
}
}
代码示例来源:origin: hopshadoop/hopsworks
public void stopAfterJob(JobID jobID) {
Preconditions.checkNotNull(jobID, "The job id must not be null");
try {
Future<Object> replyFuture = getJobManagerGateway().ask(
new ShutdownClusterAfterJob(jobID),
akkaDuration);
Await.ready(replyFuture, akkaDuration);
} catch (Exception e) {
throw new RuntimeException(
"Unable to tell application master to stop once the specified job has been finised",
e);
}
}
代码示例来源:origin: org.apache.flink/flink-yarn
private void stopAfterJob(JobID jobID) {
Preconditions.checkNotNull(jobID, "The job id must not be null");
try {
Future<Object> replyFuture =
getJobManagerGateway().ask(
new ShutdownClusterAfterJob(jobID),
akkaDuration);
Await.ready(replyFuture, akkaDuration);
} catch (Exception e) {
throw new RuntimeException("Unable to tell application master to stop once the specified job has been finised", e);
}
}
代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore
public void shutdown() {
FiniteDuration duration = datastoreContext.getShardRaftConfig().getElectionTimeOutInterval().$times(3);
try {
Await.ready(Patterns.gracefulStop(shardManager, duration, Shutdown.INSTANCE), duration);
} catch(Exception e) {
LOG.warn("ShardManager for {} data store did not shutdown gracefully", getDataStoreName(), e);
}
}
代码示例来源:origin: org.apache.flink/flink-clients_2.11
@Override
public void close() throws Exception {
if (isLoaded()) {
actorSystem.terminate();
Await.ready(actorSystem.whenTerminated(), Duration.Inf());
actorSystem = null;
}
}
内容来源于网络,如有侵权,请联系作者删除!