Author: fhanik
Date: Wed Jun 10 19:40:31 2009
New Revision: 783468
URL: http://svn.apache.org/viewvc?rev=783468&view=rev
Log:
Revert my previously not so clever implementation.
If there is an executor being used, then one shall expect that the executor is
reporting the numbers of threads itself, and it should no longer be the
responsibility of the connector
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=783468&r1=783467&r2=783468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Jun 10
19:40:31 2009
@@ -17,12 +17,10 @@
package org.apache.tomcat.util.net;
-import java.lang.reflect.Method;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadPoolExecutor;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
@@ -38,7 +36,6 @@
import org.apache.tomcat.jni.SSLSocket;
import org.apache.tomcat.jni.Socket;
import org.apache.tomcat.jni.Status;
-import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.res.StringManager;
/**
@@ -548,22 +545,7 @@
*/
public int getCurrentThreadCount() {
if (executor!=null) {
- if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getPoolSize();
- } else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getPoolSize", new Class[]
{});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getPoolSize",ignore);
- return -2;
- }
- }
+ return -1;
} else {
return curThreads;
}
@@ -576,22 +558,7 @@
*/
public int getCurrentThreadsBusy() {
if (executor!=null) {
- if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getActiveCount();
- } else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getActiveCount", new
Class[] {});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getActiveCount",ignore);
- return -2;
- }
- }
+ return -1;
} else {
return workers!=null?curThreads - workers.size():0;
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=783468&r1=783467&r2=783468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Wed Jun 10
19:40:31 2009
@@ -18,13 +18,11 @@
package org.apache.tomcat.util.net;
import java.io.IOException;
-import java.lang.reflect.Method;
import java.net.BindException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadPoolExecutor;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
@@ -306,22 +304,7 @@
*/
public int getCurrentThreadCount() {
if (executor!=null) {
- if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getPoolSize();
- } else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getPoolSize", new Class[]
{});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getPoolSize",ignore);
- return -2;
- }
- }
+ return -1;
} else {
return curThreads;
}
@@ -334,22 +317,7 @@
*/
public int getCurrentThreadsBusy() {
if (executor!=null) {
- if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getActiveCount();
- } else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getActiveCount", new
Class[] {});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getActiveCount",ignore);
- return -2;
- }
- }
+ return -1;
} else {
return workers!=null?curThreads - workers.size():0;
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=783468&r1=783467&r2=783468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Jun 10
19:40:31 2009
@@ -20,7 +20,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -731,21 +730,10 @@
if (executor instanceof ThreadPoolExecutor) {
return ((ThreadPoolExecutor)executor).getPoolSize();
} else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getPoolSize", new Class[]
{});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getPoolSize",ignore);
- return -2;
- }
+ return -1;
}
} else {
- return -1;
+ return -2;
}
}
@@ -759,21 +747,10 @@
if (executor instanceof ThreadPoolExecutor) {
return ((ThreadPoolExecutor)executor).getActiveCount();
} else {
- try {
- Method m =
IntrospectionUtils.findMethod(executor.getClass(), "getActiveCount", new
Class[] {});
- if (m!=null) {
- return ((Integer)m.invoke(executor, null)).intValue();
- } else {
- return -1;
- }
- }catch (Exception ignore) {
- if (log.isDebugEnabled())
- log.debug("Unable to invoke getActiveCount",ignore);
- return -2;
- }
+ return -1;
}
} else {
- return -1;
+ return -2;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]