当前位置: 首页>>代码示例>>Java>>正文


Java TimeoutException.getMessage方法代码示例

本文整理汇总了Java中java.util.concurrent.TimeoutException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java TimeoutException.getMessage方法的具体用法?Java TimeoutException.getMessage怎么用?Java TimeoutException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.TimeoutException的用法示例。


在下文中一共展示了TimeoutException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import java.util.concurrent.TimeoutException; //导入方法依赖的package包/类
private void init() throws IOException {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setAutomaticRecoveryEnabled(true);
    factory.setHost(this.server);
    if (this.port > 0) factory.setPort(this.port);
    if (this.username != null && this.username.length() > 0) factory.setUsername(this.username);
    if (this.password != null && this.password.length() > 0) factory.setPassword(this.password);
    try {
        this.connection = factory.newConnection();
        //Map<String, Object> map = this.connection.getServerProperties();
        if (!this.connection.isOpen()) throw new IOException("no connection");
        this.channel = connection.createChannel();
        if (!this.channel.isOpen()) throw new IOException("no channel");
        this.queues = new ConcurrentHashMap<>();
    } catch (TimeoutException e) {
        throw new IOException(e.getMessage());
    }
}
 
开发者ID:yacy,项目名称:yacy_grid_mcp,代码行数:19,代码来源:RabbitQueueFactory.java

示例2: waitForStart

import java.util.concurrent.TimeoutException; //导入方法依赖的package包/类
@SuppressWarnings({"SleepWhileHoldingLock", "SleepWhileInLoop"})
private boolean waitForStart() throws DatabaseException {
    int tries = 0;
    while (tries <= 5 && !stopWaiting) {
        tries++;

        try {
            // wait for perform start command first
            Thread.sleep(2000);
        } catch (InterruptedException ie) {
            LOGGER.log(Level.INFO, "Interrupted waiting for server to start", ie);
            Thread.currentThread().interrupt();
            return false;
        }

        try {
            server.reconnect();
            return true;
        } catch (DatabaseException dbe) {
            errorMessage = dbe.getMessage();
            LOGGER.log(Level.INFO, null, dbe);
            if (! DatabaseUtils.isCommunicationsException(dbe)) {
                throw dbe;
            }
        } catch (TimeoutException te) {
            errorMessage = te.getMessage();
            LOGGER.log(Level.INFO, null, te);
        }

    }

    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:StartManager.java

示例3: getDoneFromTimeoutOverload

import java.util.concurrent.TimeoutException; //导入方法依赖的package包/类
/**
 * Retrieves the result of a {@code Future} known to be done but uses the {@code get(long,
 * TimeUnit)} overload in order to test that method.
 */
static <V> V getDoneFromTimeoutOverload(Future<V> future) throws ExecutionException {
  checkState(future.isDone(), "Future was expected to be done: %s", future);
  try {
    return getUninterruptibly(future, 0, SECONDS);
  } catch (TimeoutException e) {
    AssertionFailedError error = new AssertionFailedError(e.getMessage());
    error.initCause(e);
    throw error;
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:15,代码来源:TestPlatform.java


注:本文中的java.util.concurrent.TimeoutException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。