java.util.concurrent.TimeoutException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中java.util.concurrent.TimeoutException.toString()方法的一些代码示例,展示了TimeoutException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeoutException.toString()方法的具体详情如下:
包路径:java.util.concurrent.TimeoutException
类名称:TimeoutException
方法名:toString

TimeoutException.toString介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Execute the shutdown.
 * This is exposed purely for testing: do not invoke it.
 * @return the number of shutdown hooks which timed out.
 */
@InterfaceAudience.Private
@VisibleForTesting
static int executeShutdown() {
 int timeouts = 0;
 for (HookEntry entry: MGR.getShutdownHooksInOrder()) {
  Future<?> future = EXECUTOR.submit(entry.getHook());
  try {
   future.get(entry.getTimeout(), entry.getTimeUnit());
  } catch (TimeoutException ex) {
   timeouts++;
   future.cancel(true);
   LOG.warn("ShutdownHook '" + entry.getHook().getClass().
     getSimpleName() + "' timeout, " + ex.toString(), ex);
  } catch (Throwable ex) {
   LOG.warn("ShutdownHook '" + entry.getHook().getClass().
     getSimpleName() + "' failed, " + ex.toString(), ex);
  }
 }
 return timeouts;
}

代码示例来源:origin: Alluxio/alluxio

.setTimeoutMs(5 * Constants.SECOND_MS));
} catch (TimeoutException e) {
 LOG.info(e.toString());
 continue;

代码示例来源:origin: org.apache.thrift/libthrift

LOGGER.error("timeout for fetch: "+te.toString());

代码示例来源:origin: com.caucho/resin

void waitFor(long timeout)
{
 try {
  _future.get(timeout, TimeUnit.MILLISECONDS);
 } catch (TimeoutException e) {
  log.log(Level.FINER, e.toString(), e);
  
  log.info(WebApp.this + " did not start within " + timeout + "ms");
 } catch (Exception e) {
  throw ConfigException.create(e);
 }
}

代码示例来源:origin: io.hops/hadoop-common

future.cancel(true);
 LOG.warn("ShutdownHook '" + entry.getHook().getClass().
   getSimpleName() + "' timeout, " + ex.toString(), ex);
} catch (Throwable ex) {
 LOG.warn("ShutdownHook '" + entry.getHook().getClass().

代码示例来源:origin: com.xiaomi.infra.galaxy/galaxy-thrift-api

LOG.error("timeout for fetch: "+te.toString());

代码示例来源:origin: XiaoMi/galaxy-sdk-java

LOG.error("timeout for fetch: "+te.toString());

代码示例来源:origin: com.ironoreserver/com.ironoreserver.core

protected Integer read(int timeout, ByteBuffer bb)  {
  try {
    if (sslEngine != null) {
      return sslEngineController.read(bb);
    }
    else {
      return ((timeout < 0) ? socket.read(bb).get() : socket.read(bb).get(timeout, TimeUnit.MILLISECONDS));
    }
  }
  catch(TimeoutException e) {
    throw new SocketInfoTimeoutException(e.toString(), e);
  }
  catch(InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new SocketInfoException(e.toString(), e);
  }
  catch(SSLException e) {
    throw new SocketInfoException(e.toString(), e);
  }
  catch(IOException | ExecutionException e) {
    throw new SocketInfoException(e.toString(), e);
  } 
}

代码示例来源:origin: apache/incubator-slider

errorText = e.toString();

代码示例来源:origin: org.apache.slider/slider-core

errorText = e.toString();

代码示例来源:origin: com.cisco.oss.foundation/http-client-jetty

@Override
public HttpResponse executeDirect(HttpRequest request){
  Request httpRequest = prepareRequest(request);
  try {
    ContentResponse contentResponse = httpRequest.send();
    return new JettyHttpResponse(contentResponse, httpRequest.getURI());
  } catch (InterruptedException e) {
    throw new ClientException(e.toString(), e);
  } catch (TimeoutException e) {
    throw new RequestTimeoutException(e.toString(), e);
  } catch (ExecutionException e) {
    throw new ClientException(e.toString(), e);
  }
}

代码示例来源:origin: gmr/rabbitmq-flume-plugin

private Connection createRabbitMQConnection(Config config) throws IOException {
  logger.debug("Connecting to RabbitMQ from {}", this);
  config = config.withRecoveryPolicy(RecoveryPolicies.recoverAlways())
        .withRetryPolicy(new RetryPolicy()
            .withMaxAttempts(200)
            .withInterval(Duration.seconds(1))
            .withMaxDuration(Duration.minutes(5)));
  ConnectionOptions options = new ConnectionOptions()
      .withHost(hostname)
      .withPort(port)
      .withVirtualHost(virtualHost)
      .withUsername(username)
      .withPassword(password)
      ;
  if (sslEnabled) {
    try {
      options = options.withSsl();
    } catch (NoSuchAlgorithmException e) {
      logger.error("Could not enable SSL: {}", e.toString());
    } catch (KeyManagementException e) {
      logger.error("Could not enable SSL: {}", e.toString());
    }
  }
  try {
    return Connections.create(options, config);
  } catch (java.util.concurrent.TimeoutException e) {
    logger.error("Timeout connecting to RabbitMQ: {}", e.toString());
    throw new IOException();
  }
}

相关文章