Added JMX annotations for ScheduledExecutorScheduler

Signed-off-by: Ravi Kumar <kumarravi1165@gmail.com>
This commit is contained in:
Ravi Kumar 2020-12-17 21:27:03 +05:30
parent d5648c73a1
commit a4dc95aa79
1 changed files with 21 additions and 0 deletions

View File

@ -25,6 +25,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
@ -37,6 +39,7 @@ import org.eclipse.jetty.util.component.Dumpable;
* queue even if the task did not fire, which provides a huge benefit in the performance
* of garbage collection in young generation.
*/
@ManagedObject("A scheduler")
public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable
{
private final String name;
@ -154,4 +157,22 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
return scheduledFuture.cancel(false);
}
}
@ManagedAttribute("name of scheduler")
public String getName()
{
return name;
}
@ManagedAttribute("is scheduler daemon")
public boolean isDaemon()
{
return daemon;
}
@ManagedAttribute("number of scheduler threads")
public int getThreads()
{
return threads;
}
}