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

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

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

TimeoutException.printStackTrace介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

e.printStackTrace();

代码示例来源:origin: vector4wang/spring-boot-quick

public static void main(String[] args) {
    try {
      ConnectionFactory factory = new ConnectionFactory();
      factory.setUsername("guest");
      factory.setPassword("guest");
      factory.setHost("60.205.191.82");
      factory.setPort(5672);
      Connection conn = factory.newConnection();
      Channel channel = conn.createChannel();

//            channel.qu
      channel.queueDeclare("hello", false, false, false, null);
      String message = "Hello World!";
      channel.basicPublish("", "hello", null, message.getBytes());
      System.out.println(" [x] Sent '" + message + "'");

      channel.close();
      conn.close();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (TimeoutException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: ukanth/afwall

} catch (TimeoutException e) {
  print("[ TIMEOUT EXCEPTION! ]\n");
  e.printStackTrace();
} catch (RootDeniedException e) {
  print("[ ROOT DENIED EXCEPTION! ]\n");

代码示例来源:origin: Stericson/RootTools

} catch (TimeoutException e) {
  print("[ TIMEOUT EXCEPTION! ]\n");
  e.printStackTrace();
} catch (RootDeniedException e) {
  print("[ ROOT DENIED EXCEPTION! ]\n");

代码示例来源:origin: ukanth/afwall

e.printStackTrace();

代码示例来源:origin: tianzhijiexian/Logcat

@Override
  public V get(long timeout, @NonNull TimeUnit unit) {
    try {
      return super.get(timeout, unit);
    } catch (InterruptedException e) {
      e.printStackTrace();
      return null;
    } catch (ExecutionException e) {
      e.printStackTrace();
      return null;
    } catch (TimeoutException e) {
      e.printStackTrace();
      return null;
    }
  }
}

代码示例来源:origin: org.projectodd.wunderboss/wunderboss-messaging

@Override
public Message get() throws InterruptedException, ExecutionException {
  try {
    return get(0, TimeUnit.SECONDS);
  } catch (TimeoutException e) {
    //shouldn't happen
    e.printStackTrace();
    return null;
  }
}

代码示例来源:origin: com.github.cafdataprocessing/worker-policy-testing

public static void CloseChannel(Channel channel) throws IOException {
  try {
    channel.close();
  } catch (TimeoutException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: dhleong/intellivim

@Override
public Result get() throws InterruptedException, ExecutionException {
  try {
    return get(1, TimeUnit.MINUTES);
  } catch (TimeoutException e) {
    // hopefully won't happen
    e.printStackTrace();
    throw new RuntimeException("Command took a MINUTE to execute!", e);
  }
}

代码示例来源:origin: org.jppf/jppf-client

/**
 * Process the completion of a task future.
 * @param future the future to process.
 */
private void processFutureCompletion(final JPPFTaskFuture<V> future) {
 if (future == null) throw new IllegalArgumentException("future should not be null");
 try {
  future.getResult(0L);
 } catch (final TimeoutException e) {
  e.printStackTrace();
 }
 queue.offer(future);
}

代码示例来源:origin: qiurunze123/threadandjuc

@Override
    public void run() {
      try {
        Thread.sleep(1000*(new Random()).nextInt(8));
        System.out.println(name+"准备好了。。。。。");
        //barrier的await方法 在所有参与者 都在此barrier上 调用await方法   方法之前一直等待
//                barrier.await();
        //设置等待时间 如果等待了一秒 线程还没有就位 则自己继续运行 但是会导致barrier被标记为一个已经被破坏的barrier
        barrier.await(2, TimeUnit.SECONDS);
      } catch (InterruptedException e) {
        System.out.println(name+"中断异常");
      } catch (BrokenBarrierException e) {
        System.out.println(name+"Barrier损坏异常!");
      } catch (TimeoutException e) {
        e.printStackTrace();
      }

      System.out.println(name+"起跑!");
    }

代码示例来源:origin: Shimingli/PerformanceOptimizationForAndroid

private boolean ping(String ip) {
  try {
    Integer status = executeCommandIp( ip, PING_TIME_OUT );
    if ( status != null && status == 0 ) {
      return true;
    } else {
      return false;
    }
  } catch (IOException e) {
    e.printStackTrace();
  } catch (InterruptedException e) {
    e.printStackTrace();
  } catch (TimeoutException e) {
    e.printStackTrace();
  }
  return false;
}
/**

代码示例来源:origin: Shimingli/PerformanceOptimizationForAndroid

/**
 * 测试主域名返回ip地址
 * @param domain
 * @return ip地址,为空则ping不通
 */
private String ping4Domain(final String domain) {
  String ip = "";
  try {
    ip = executeCommand(domain,PING_TIME_OUT);
  } catch (IOException e) {
    e.printStackTrace();
    ip = "IOException";
  } catch (InterruptedException e) {
    e.printStackTrace();
    ip = "InterruptedException";
  } catch (TimeoutException e) {
    e.printStackTrace();
    ip = "www.baidu.com";
  }
  return ip;
}

代码示例来源:origin: org.immutables/service

@Override
 public void run() {
  try {
   manager.stopAsync().awaitStopped(2, TimeUnit.SECONDS);
  } catch (TimeoutException timeout) {
   timeout.printStackTrace();
  }
 }
});

代码示例来源:origin: apache/cxf

public static void main(String[] args) throws InterruptedException, ExecutionException {
    final String url = "http://localhost:" + PORT + "/async/bookstore/disconnect";
    WebClient wc = WebClient.create(url);
    try {
      System.out.println("server ready");
      wc.async().get().get(500, TimeUnit.MILLISECONDS);
    } catch (TimeoutException ex) {
      ex.printStackTrace();
    } finally {
      System.out.println("server stopped");
      System.out.println("done!");
      System.exit(0);
    }
  }
}

代码示例来源:origin: openmessaging/openmessaging-benchmark

@Override
public void initialize(File configurationFile, StatsLogger statsLogger) throws IOException {
  config = mapper.readValue(configurationFile, RabbitMqConfig.class);
  ConnectionFactory connectionFactory = new ConnectionFactory();
  connectionFactory.setAutomaticRecoveryEnabled(true);
  connectionFactory.setHost(config.brokerAddress);
  connectionFactory.setUsername("admin");
  connectionFactory.setPassword("admin");
  try {
    connection = connectionFactory.newConnection();
  } catch (TimeoutException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: apache/jclouds

@Override
  @AfterClass(groups = { "integration", "live" })
  protected void tearDown() {
   try {
     awaitComplete(api, api.getDomainApi().delete(ImmutableList.<Integer> of(domainId), true));
   }
   catch (TimeoutException e) {
     e.printStackTrace();
   }
   super.tearDown();
  }
}

代码示例来源:origin: apache/jclouds

@Override
  @AfterClass(groups = { "integration", "live" })
  protected void tearDown() {
   List<Integer> domainIds = Lists.newArrayList();
   
   for (Domain domain : testDomains.values()) {
     domainIds.add(domain.getId());
   }

   try {
     awaitComplete(api, api.getDomainApi().delete(domainIds, true));
   }
   catch (TimeoutException e) {
     e.printStackTrace();
   }
   super.tearDown();
  }
}

代码示例来源:origin: apache/jclouds

@Override
  @AfterClass(groups = { "integration", "live" })
  protected void tearDown() {
   try {
     computeService.destroyNode(serverId);
     awaitComplete(api, api.getDomainApi().delete(ImmutableList.<Integer> of(domainId), true));
   }
   catch (TimeoutException e) {
     e.printStackTrace();
   }
   super.tearDown();
  }
}

代码示例来源:origin: Netflix/CassJMeter

@Override
public ResponseData get(Object rkey, Object colName) throws OperationException {
  Session session = DataStaxClientConnection.instance.session();
  TableMetadata tm = DataStaxClientConnection.instance.getKeyspaceMetadata().getTable(cfName);
  String partitionKey = tm.getPartitionKey().get(0).getName();
  
  Query query = QueryBuilder.select(colName.toString()).from(cfName).where(QueryBuilder.eq(partitionKey, rkey)).limit(1000000)
      .setConsistencyLevel(ConsistencyLevel.valueOf(com.netflix.jmeter.properties.Properties.instance.cassandra.getReadConsistency()));
  
  ResultSetFuture rs = session.executeAsync(query);
  int size = 0;
  try {
    Row row = rs.getUninterruptibly(1000000, TimeUnit.MILLISECONDS).one();
    size = row != null ? row.getBytesUnsafe(colName.toString()).capacity() : 0;
  }
  catch (TimeoutException e) {
    e.printStackTrace();
    throw new OperationException(e);
  }
  return new DataStaxClientResponseData("", size, "", 0, rkey, colName, null);
}

相关文章