Skip to content

Commit

Permalink
Merge pull request #5821 from rk1165/issue_5816
Browse files Browse the repository at this point in the history
Fixes #5816 : JMX-ify Scheduler implementations
  • Loading branch information
sbordet committed Dec 18, 2020
2 parents 5611c2d + 433f612 commit ea24a81
Showing 1 changed file with 21 additions and 0 deletions.
Expand Up @@ -25,6 +25,8 @@
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;
Expand All @@ -37,6 +39,7 @@
* 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;
Expand Down Expand Up @@ -154,4 +157,22 @@ public boolean cancel()
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;
}
}

0 comments on commit ea24a81

Please sign in to comment.