There is no getter for queue size, only queue capacity.
If I use jmx to monnitor ThreadPoolTaskExecutor, how can I monitor queue size level to make sure it is healthy?
There is no getter for queue size, only queue capacity.
If I use jmx to monnitor ThreadPoolTaskExecutor, how can I monitor queue size level to make sure it is healthy?
executor.getThreadPoolExecutor().getQueue().size()
EDIT
@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();
}
}
© 2022 - 2024 — McMap. All rights reserved.