我使用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 );
}