我检查了http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.html
没有队列大小的getter,只有队列容量。
如果我使用jmx监视ThreadPoolTaskExecutor,我如何监视队列大小级别以确保它是健康的?
executor.getThreadPoolExecutor().getQueue().size()
编辑
@ManagedResource
public class MyTEMBean {
private final ThreadPoolTaskExecutor te;
public MyTEMBean(ThreadPoolTaskExecutor te) {
this.te = te;
}
@ManagedAttribute
public int getQueueSize() {
return this.te.getThreadPoolExecutor().getQueue().size();
}
}