Merge pull request #5821 from rk1165/issue_5816

Fixes #5816 : JMX-ify Scheduler implementations
This commit is contained in:
Simone Bordet 2020-12-18 09:53:02 +01:00 committed by GitHub
commit ea24a8146d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
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("The name of the scheduler")
public String getName()
{
return name;
}
@ManagedAttribute("Whether the scheduler uses daemon threads")
public boolean isDaemon()
{
return daemon;
}
@ManagedAttribute("The number of scheduler threads")
public int getThreads()
{
return threads;
}
}