在对部署在tomcat 7上的旧版Java Spring Maven项目进行调查时,日志如下所示-
2018-08-29 18:16:42:471 +0600 [http-bio-8080-exec-494] [错误]
要求使数字神秘化
exec-
那么,基本上“ exec”的含义是什么? 在上述情况下为 494 。
答案 0 :(得分:2)
这是tomcat中的线程池生成的线程ID号。真正的问题是不同的,既然您知道内部信息,那么内部信息的价值是什么?我假设接近零...
答案 1 :(得分:1)
很可能是自定义ThreadFactory
生成的线程ID,就像:
Executor executor = Executors.newFixedThreadPool(4, new ThreadFactory() {
AtomicInteger threadId = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "http-bio-8080-exec-" + threadId.getAndIncrement()); // custom a thread factory
}
});
IntStream.range(0, 10).forEach(value -> {
executor.execute(() -> {
System.out.println(Thread.currentThread().getName()); // print thread name
try {
Thread.sleep(100);
} catch (Exception e) {
}
});
});
输出:
http-bio-8080-exec-0
http-bio-8080-exec-1
http-bio-8080-exec-2
http-bio-8080-exec-3
http-bio-8080-exec-0
http-bio-8080-exec-3
http-bio-8080-exec-1
http-bio-8080-exec-2
http-bio-8080-exec-0
http-bio-8080-exec-3