You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jf...@apache.org on 2018/11/03 19:23:50 UTC

[2/3] tomee git commit: Allow for JMX on ManagedExecutorServices

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/33b4c815
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/33b4c815
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/33b4c815

Branch: refs/heads/tomee-7.1.x
Commit: 33b4c8152eb679e1840699ed0928773883a2f9f6
Parents: 43774cc
Author: Jonathan S. Fisher <ex...@gmail.com>
Authored: Sun Sep 23 22:44:17 2018 -0500
Committer: Jonathan S. Fisher <ex...@gmail.com>
Committed: Sat Nov 3 14:22:30 2018 -0500

----------------------------------------------------------------------
 .../impl/ManagedExecutorServiceImpl.java        | 59 +++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/33b4c815/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);
     }