Merge pull request #5821 from rk1165/issue_5816
Fixes #5816 : JMX-ify Scheduler implementations
This commit is contained in:
commit
ea24a8146d
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue