本文整理了Java中java.util.concurrent.TimeoutException.getLocalizedMessage()
方法的一些代码示例,展示了TimeoutException.getLocalizedMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeoutException.getLocalizedMessage()
方法的具体详情如下:
包路径:java.util.concurrent.TimeoutException
类名称:TimeoutException
方法名:getLocalizedMessage
暂无
代码示例来源:origin: wildfly/wildfly
@Override
public T get() throws InterruptedException, ExecutionException {
try {
// Wait at most for the configured timeout
// If the message was dropped by the receiver, this would otherwise block forever
return super.get(super.options.timeout(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
// Auto-cancel on timeout
this.cancel(true);
throw new CancellationException(e.getLocalizedMessage());
}
}
代码示例来源:origin: ccavanaugh/jgnash
private static boolean waitForCallable(final Callable<Boolean> callable) {
boolean result = false;
final ExecutorService service = Executors.newSingleThreadExecutor();
final Future<Boolean> future = service.submit(callable);
try {
result = future.get(TIMEOUT, TimeUnit.MINUTES);
service.shutdown();
} catch (final InterruptedException | ExecutionException e) { // intentionally interrupted
logger.log(Level.FINEST, e.getLocalizedMessage(), e);
} catch (final TimeoutException e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
return result;
}
代码示例来源:origin: org.jboss.eap/wildfly-clustering-server
@Override
public T get() throws InterruptedException, ExecutionException {
try {
// Wait at most for the configured timeout
// If the message was dropped by the receiver, this would otherwise block forever
return super.get(super.options.timeout(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
// Auto-cancel on timeout
this.cancel(true);
throw new CancellationException(e.getLocalizedMessage());
}
}
代码示例来源:origin: apache/samza
latch.await(30, TimeUnit.SECONDS);
} catch (TimeoutException e) {
Assert.fail(String.format("await timed out from %s - %s", participant1, e.getLocalizedMessage()));
} finally {
zkUtils.close();
内容来源于网络,如有侵权,请联系作者删除!