本文整理汇总了Java中scala.concurrent.Await.ready方法的典型用法代码示例。如果您正苦于以下问题:Java Await.ready方法的具体用法?Java Await.ready怎么用?Java Await.ready使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scala.concurrent.Await
的用法示例。
在下文中一共展示了Await.ready方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopAfterJob
import scala.concurrent.Await; //导入方法依赖的package包/类
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);
}
}
示例2: run
import scala.concurrent.Await; //导入方法依赖的package包/类
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());
}
示例3: shutdown
import scala.concurrent.Await; //导入方法依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
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);
}
}
示例4: tearDown
import scala.concurrent.Await; //导入方法依赖的package包/类
@After
public void tearDown() throws TimeoutException, InterruptedException {
Await.ready(system.terminate(), Duration.Inf());
}