无效的线程ID参数:0 java,怎么会发生这种情况?

时间:2012-10-26 05:46:53

标签: java multithreading solr solrcloud

我使用solr 4.0并遇到一个奇怪的错误。我使用一个shard三个节点运行一个solr云。ThreadDumpHandler告诉我有一个ID为0的无效线程。

ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
long[] tids = tmbean.getAllThreadIds();
log.info("all threads tids:" + (tids == null? "null" :tids.length));
if (tids != null) {
  for (long l :tids) {
    log.info(String.valueOf(l));
  }
  log.info("all thread infos:");
  NamedList<SimpleOrderedMap<Object>> lst = new NamedList<SimpleOrderedMap<Object>>();
  for (long l :tids) {
    if (l > 0) {
      ThreadInfo ti = tmbean.getThreadInfo(l, Integer.MAX_VALUE);
      if (ti != null) {
        log.info(ti.toString());
        lst.add( "thread", getThreadInfo( ti, tmbean ) );
      }
    } else {
      log.info("invalid thread id:" + l);
    }

  }
  system.add( "threadDump", lst );
}

0 个答案:

没有答案