Repository: tomee Updated Branches: refs/heads/tomee-7.0.x 4309ec73f -> 4f56a3009
Allow for JMX on ManagedExecutorServices Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1590538b Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1590538b Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1590538b Branch: refs/heads/tomee-7.0.x Commit: 1590538beb144aacc576728bb6c34512e05a47a8 Parents: 4c98121 Author: Jonathan S. Fisher <exabr...@gmail.com> Authored: Sun Sep 23 22:44:17 2018 -0500 Committer: Jonathan S. Fisher <exabr...@gmail.com> Committed: Sun Sep 23 22:44:17 2018 -0500 ---------------------------------------------------------------------- .../impl/ManagedExecutorServiceImpl.java | 59 +++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/1590538b/container/openejb-core/src/main/java/org/apache/openejb/threads/impl/ManagedExecutorServiceImpl.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/threads/impl/ManagedExecutorServiceImpl.java b/container/openejb-core/src/main/java/org/apache/openejb/threads/impl/ManagedExecutorServiceImpl.java index e710aa8..59831b4 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/threads/impl/ManagedExecutorServiceImpl.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/threads/impl/ManagedExecutorServiceImpl.java @@ -29,6 +29,7 @@ import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class ManagedExecutorServiceImpl extends AbstractExecutorService implements ManagedExecutorService, DestroyableResource { @@ -59,8 +60,64 @@ public class ManagedExecutorServiceImpl extends AbstractExecutorService implemen public boolean isTerminated() { return delegate.isTerminated(); } + + public Integer getCorePoolSize() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getCorePoolSize(); + } else { + return null; + } + } + + public Integer getMaximumPoolSize() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getMaximumPoolSize(); + } else { + return null; + } + } - @Override + public Integer getPoolSize() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getPoolSize(); + } else { + return null; + } + } + + public Integer getActiveCount() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getActiveCount(); + } else { + return null; + } + } + + public Integer getLargestPoolSize() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getLargestPoolSize(); + } else { + return null; + } + } + + public Long getTaskCount() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getTaskCount(); + } else { + return null; + } + } + + public Long getCompletedTaskCount() { + if (delegate instanceof ThreadPoolExecutor) { + return ((ThreadPoolExecutor) delegate).getCompletedTaskCount(); + } else { + return null; + } + } + + @Override public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException { return delegate.awaitTermination(timeout, unit); }