JBossWeb SVN: r1681 - trunk/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-16 06:09:18 -0400 (Wed, 16 Mar 2011)
New Revision: 1681
Modified:
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
Reduce the poller size counts, as the Servlet 3 and event functionality is tied to a matching processor,
making the functionality memory intensive.
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-15 14:18:04 UTC (rev 1680)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-16 10:09:18 UTC (rev 1681)
@@ -582,22 +582,6 @@
useSendfile = false;
}
- // Poller size defaults
- if (pollerSize <= 0) {
- if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
- pollerSize = (1 * 1024);
- } else {
- pollerSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (8 * 1024) : (32 * 1024);
- }
- }
- if (sendfileSize <= 0) {
- if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
- sendfileSize = 128;
- } else {
- sendfileSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (1 * 1024) : (16 * 1024);
- }
- }
-
long inetAddress = Address.info(addressStr, family,
port, 0, rootPool);
@@ -1442,6 +1426,18 @@
pool = Pool.create(serverSockPool);
actualPollerSize = pollerSize;
+ // Poller size defaults
+ if (actualPollerSize <= 0) {
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ if (event) {
+ actualPollerSize = 128;
+ } else {
+ actualPollerSize = 1024;
+ }
+ } else {
+ actualPollerSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (8 * 1024) : (32 * 1024);
+ }
+ }
if ((OS.IS_WIN32 || OS.IS_WIN64) && (actualPollerSize > 1024)) {
// The maximum per poller to get reasonable performance is 1024
// Adjust poller size so that it won't reach the limit
@@ -2134,6 +2130,13 @@
protected void init() {
pool = Pool.create(serverSockPool);
int size = sendfileSize;
+ if (size <= 0) {
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ size = 128;
+ } else {
+ size = (OS.IS_WIN32 || OS.IS_WIN64) ? (1 * 1024) : (16 * 1024);
+ }
+ }
sendfilePollset = allocatePoller(size, pool, soTimeout);
if (sendfilePollset == 0 && size > 1024) {
size = 1024;
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-15 14:18:04 UTC (rev 1680)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-16 10:09:18 UTC (rev 1681)
@@ -171,7 +171,7 @@
/**
* Size of the socket poller.
*/
- protected int pollerSize = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? (1 * 1024) : (32 * 1024);
+ protected int pollerSize = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 128 : (32 * 1024);
public void setPollerSize(int pollerSize) { this.pollerSize = pollerSize; }
public int getPollerSize() { return pollerSize; }
13 years, 12 months
JBossWeb SVN: r1680 - in trunk: java/org/apache/coyote/ajp and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-15 10:18:04 -0400 (Tue, 15 Mar 2011)
New Revision: 1680
Modified:
trunk/java/org/apache/coyote/ProtocolHandler.java
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java
trunk/webapps/docs/changelog.xml
Log:
Add API to access the request processors stats from the Connector class.
Modified: trunk/java/org/apache/coyote/ProtocolHandler.java
===================================================================
--- trunk/java/org/apache/coyote/ProtocolHandler.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/ProtocolHandler.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -61,6 +61,9 @@
public boolean hasIoEvents();
+ public RequestGroupInfo getRequestGroupInfo();
+
+
/**
* Init the protocol.
*/
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -160,7 +160,11 @@
return false;
}
+ public RequestGroupInfo getRequestGroupInfo() {
+ return cHandler.global;
+ }
+
/** Start the protocol
*/
public void init() throws Exception {
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -158,7 +158,11 @@
return false;
}
+ public RequestGroupInfo getRequestGroupInfo() {
+ return cHandler.global;
+ }
+
/** Start the protocol
*/
public void init() throws Exception {
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -106,7 +106,11 @@
return true;
}
+ public RequestGroupInfo getRequestGroupInfo() {
+ return cHandler.global;
+ }
+
/** Start the protocol
*/
public void init() throws Exception {
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -151,6 +151,9 @@
return false;
}
+ public RequestGroupInfo getRequestGroupInfo() {
+ return cHandler.global;
+ }
public void init() throws Exception {
endpoint.setName(getName());
Modified: trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java
===================================================================
--- trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/java/org/apache/coyote/memory/MemoryProtocolHandler.java 2011-03-15 14:18:04 UTC (rev 1680)
@@ -26,6 +26,7 @@
import org.apache.coyote.OutputBuffer;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.Request;
+import org.apache.coyote.RequestGroupInfo;
import org.apache.coyote.Response;
@@ -75,7 +76,11 @@
return false;
}
+ public RequestGroupInfo getRequestGroupInfo() {
+ return null;
+ }
+
// ------------------------------------------------ ProtocolHandler Methods
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-03-15 14:06:08 UTC (rev 1679)
+++ trunk/webapps/docs/changelog.xml 2011-03-15 14:18:04 UTC (rev 1680)
@@ -16,6 +16,23 @@
<body>
+<section name="JBoss Web 7.0.0.Beta6 (remm)">
+ <subsection name="General">
+ <changelog>
+ <fix>
+ Tune low memory use defaults. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Expose the request info objects using a Java API on ProtocolHandler. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.0.0.Beta5 (remm)">
<subsection name="General">
<changelog>
13 years, 12 months
JBossWeb SVN: r1679 - trunk/java/org/apache/catalina/connector.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-15 10:06:08 -0400 (Tue, 15 Mar 2011)
New Revision: 1679
Modified:
trunk/java/org/apache/catalina/connector/Request.java
Log:
No local random in lowmem mode.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2011-03-14 16:11:49 UTC (rev 1678)
+++ trunk/java/org/apache/catalina/connector/Request.java 2011-03-15 14:06:08 UTC (rev 1679)
@@ -157,7 +157,7 @@
protected static final boolean LOCAL_RANDOM =
- Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.LOCAL_RANDOM", "true")).booleanValue();
+ Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.LOCAL_RANDOM", (org.apache.tomcat.util.Constants.LOW_MEMORY) ? "false" : "true")).booleanValue();
// ----------------------------------------------------------- Constructors
13 years, 12 months
JBossWeb SVN: r1678 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-14 12:11:49 -0400 (Mon, 14 Mar 2011)
New Revision: 1678
Added:
tags/JBOSSWEB_7_0_0_BETA5/
Log:
- Beta5.
14 years
JBossWeb SVN: r1677 - in trunk: java/org/apache/tomcat/util/net and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-14 09:56:39 -0400 (Mon, 14 Mar 2011)
New Revision: 1677
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
trunk/webapps/docs/changelog.xml
Log:
- Lower the static file cache for the low mem scenario (I'll keep it for now).
- Add back the "wait for an available processor" code, which fits the "toy server" use quite well.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2011-03-13 17:40:52 UTC (rev 1676)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2011-03-14 13:56:39 UTC (rev 1677)
@@ -610,13 +610,13 @@
/**
* Cache max size in KB.
*/
- protected int cacheMaxSize = 10240; // 10 MB
+ protected int cacheMaxSize = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 128 : 10240; // 10 MB
/**
* Cache object max size in KB.
*/
- protected int cacheObjectMaxSize = 256; // 256K
+ protected int cacheObjectMaxSize = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 8 : 256; // 256K
/**
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-13 17:40:52 UTC (rev 1676)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-14 13:56:39 UTC (rev 1677)
@@ -964,6 +964,28 @@
/**
+ * Return a new worker thread, and block while to worker is available.
+ */
+ protected Worker getWorkerThread() {
+ // Allocate a new worker thread
+ Worker workerThread = createWorkerThread();
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ while (workerThread == null) {
+ try {
+ synchronized (workers) {
+ workers.wait();
+ }
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ workerThread = createWorkerThread();
+ }
+ }
+ return workerThread;
+ }
+
+
+ /**
* Allocate a new poller of the specified size.
*/
protected long allocatePoller(int size, long pool, int timeout) {
@@ -987,7 +1009,7 @@
protected boolean processSocketWithOptions(long socket) {
try {
if (executor == null) {
- Worker worker = createWorkerThread();
+ Worker worker = getWorkerThread();
if (worker != null) {
worker.assignWithOptions(socket);
} else {
@@ -1012,7 +1034,7 @@
protected boolean processSocket(long socket) {
try {
if (executor == null) {
- Worker worker = createWorkerThread();
+ Worker worker = getWorkerThread();
if (worker != null) {
worker.assign(socket);
} else {
@@ -1037,7 +1059,7 @@
protected boolean processSocket(long socket, SocketStatus status) {
try {
if (executor == null) {
- Worker worker = createWorkerThread();
+ Worker worker = getWorkerThread();
if (worker != null) {
worker.assign(socket, status);
} else {
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-13 17:40:52 UTC (rev 1676)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-14 13:56:39 UTC (rev 1677)
@@ -1205,6 +1205,28 @@
/**
+ * Return a new worker thread, and block while to worker is available.
+ */
+ protected Worker getWorkerThread() {
+ // Allocate a new worker thread
+ Worker workerThread = createWorkerThread();
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ while (workerThread == null) {
+ try {
+ synchronized (workers) {
+ workers.wait();
+ }
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ workerThread = createWorkerThread();
+ }
+ }
+ return workerThread;
+ }
+
+
+ /**
* Recycle the specified Processor so that it can be used again.
*
* @param workerThread The processor to be recycled
@@ -1224,7 +1246,7 @@
protected boolean processSocket(Socket socket) {
try {
if (executor == null) {
- Worker worker = createWorkerThread();
+ Worker worker = getWorkerThread();
if (worker != null) {
worker.assign(socket);
} else {
@@ -1249,7 +1271,7 @@
protected boolean processSocket(Socket socket, SocketStatus status) {
try {
if (executor == null) {
- Worker worker = createWorkerThread();
+ Worker worker = getWorkerThread();
if (worker != null) {
worker.assign(socket, status);
} else {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-03-13 17:40:52 UTC (rev 1676)
+++ trunk/webapps/docs/changelog.xml 2011-03-14 13:56:39 UTC (rev 1677)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 7.0.0.Beta5 (remm)">
+ <subsection name="General">
+ <changelog>
+ <fix>
+ Add a set of low memory use defaults. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.0.0.Beta4 (remm)">
<subsection name="Catalina">
<changelog>
14 years
JBossWeb SVN: r1676 - trunk/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-13 13:40:52 -0400 (Sun, 13 Mar 2011)
New Revision: 1676
Modified:
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
- Since keepalive is disabled, maxThreads means the same as for the APR connector, except it includes
all static files, so it needs to be a bit higher.
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-13 17:37:45 UTC (rev 1675)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-13 17:40:52 UTC (rev 1676)
@@ -155,7 +155,7 @@
/**
* Maximum amount of worker threads.
*/
- protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 256 : 512 * Runtime.getRuntime().availableProcessors();
+ protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 64 : 512 * Runtime.getRuntime().availableProcessors();
public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; }
public int getMaxThreads() { return maxThreads; }
14 years
JBossWeb SVN: r1675 - in trunk/java/org/apache/coyote: http11 and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-13 13:37:45 -0400 (Sun, 13 Mar 2011)
New Revision: 1675
Modified:
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
Log:
- Set the global RP out of the if (which is going to be disabled 99% of the time now).
- Back out of not recycling request processors for java.io HTTP, it looks too expensive to be practical.
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-12 21:30:43 UTC (rev 1674)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-13 17:37:45 UTC (rev 1675)
@@ -523,14 +523,14 @@
}
protected void register(AjpAprProcessor processor) {
- if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(global);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
- (proto.getDomain() + ":type=RequestProcessor,worker="
+ (proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=AjpRequest" + count);
if (log.isDebugEnabled()) {
log.debug("Register " + rpName);
@@ -545,11 +545,11 @@
}
protected void unregister(AjpAprProcessor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(null);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
if (log.isDebugEnabled()) {
log.debug("Unregister " + rpName);
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-12 21:30:43 UTC (rev 1674)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-13 17:37:45 UTC (rev 1675)
@@ -486,12 +486,12 @@
}
protected void register(AjpProcessor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(global);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=AjpRequest" + count);
@@ -508,11 +508,11 @@
}
protected void unregister(AjpProcessor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(null);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
if (log.isDebugEnabled()) {
log.debug("Unregister " + rpName);
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-12 21:30:43 UTC (rev 1674)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-13 17:37:45 UTC (rev 1675)
@@ -684,12 +684,12 @@
}
protected void register(Http11AprProcessor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(global);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=HttpRequest" + count);
@@ -706,11 +706,11 @@
}
protected void unregister(Http11AprProcessor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(null);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
if (log.isDebugEnabled()) {
log.debug("Unregister " + rpName);
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-12 21:30:43 UTC (rev 1674)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-13 17:37:45 UTC (rev 1675)
@@ -550,13 +550,12 @@
protected static class Http11ConnectionHandler implements Handler {
protected Http11Protocol proto;
- protected AtomicLong registerCount = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? null : new AtomicLong(0);
+ protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentHashMap<Socket, Http11Processor> connections =
new ConcurrentHashMap<Socket, Http11Processor>();
protected ConcurrentLinkedQueue<Http11Processor> recycledProcessors =
- (org.apache.tomcat.util.Constants.LOW_MEMORY) ? null :
new ConcurrentLinkedQueue<Http11Processor>() {
protected AtomicInteger size = new AtomicInteger(0);
public boolean offer(Http11Processor processor) {
@@ -627,9 +626,7 @@
} finally {
if (state != SocketState.LONG) {
connections.remove(socket);
- if (recycledProcessors != null) {
- recycledProcessors.offer(result);
- }
+ recycledProcessors.offer(result);
} else {
if (proto.endpoint.isRunning()) {
proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
@@ -643,7 +640,7 @@
}
public SocketState process(Socket socket) {
- Http11Processor processor = (recycledProcessors != null) ? recycledProcessors.poll() : null;
+ Http11Processor processor = recycledProcessors.poll();
try {
if (processor == null) {
@@ -665,7 +662,7 @@
connections.put(socket, processor);
proto.endpoint.getEventPoller().add(socket, processor.getTimeout(),
processor.getResumeNotification(), false);
- } else if (recycledProcessors != null) {
+ } else {
recycledProcessors.offer(processor);
}
return state;
@@ -691,9 +688,7 @@
Http11Protocol.log.error
(sm.getString("http11protocol.proto.error"), e);
}
- if (recycledProcessors != null) {
- recycledProcessors.offer(processor);
- }
+ recycledProcessors.offer(processor);
return SocketState.CLOSED;
}
@@ -713,19 +708,17 @@
processor.setSocketBuffer(proto.socketBuffer);
processor.setMaxSavePostSize(proto.maxSavePostSize);
processor.setServer(proto.server);
- if (!org.apache.tomcat.util.Constants.LOW_MEMORY) {
- register(processor);
- }
+ register(processor);
return processor;
}
protected void register(Http11Processor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(global);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=HttpRequest" + count);
@@ -742,11 +735,11 @@
}
protected void unregister(Http11Processor processor) {
+ RequestInfo rp = processor.getRequest().getRequestProcessor();
+ rp.setGlobalProcessor(null);
if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
- RequestInfo rp = processor.getRequest().getRequestProcessor();
- rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
if (log.isDebugEnabled()) {
log.debug("Unregister " + rpName);
14 years
JBossWeb SVN: r1674 - in trunk/java/org/apache: coyote/http11 and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-12 16:30:43 -0500 (Sat, 12 Mar 2011)
New Revision: 1674
Modified:
trunk/java/org/apache/catalina/connector/Connector.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/tomcat/util/buf/StringCache.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
Log:
- Add various low memory defaults.
- Recycle facades.
- Discard processors and disable keepalive for HTTP java.io.
- Disable string cache.
- Lower polleSize for APR and java.io.
- Lower sendfileSize for APR.
- AJP will still use more memory (it requires lots of active processors), and native HTTP should retain
decent performance (java.io HTTP will drop however).
Modified: trunk/java/org/apache/catalina/connector/Connector.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Connector.java 2011-03-12 17:58:07 UTC (rev 1673)
+++ trunk/java/org/apache/catalina/connector/Connector.java 2011-03-12 21:30:43 UTC (rev 1674)
@@ -60,7 +60,8 @@
* Alternate flag to enable recycling of facades.
*/
public static final boolean RECYCLE_FACADES =
- Boolean.valueOf(System.getProperty("org.apache.catalina.connector.RECYCLE_FACADES", "false")).booleanValue();
+ Boolean.valueOf(System.getProperty("org.apache.catalina.connector.RECYCLE_FACADES",
+ (org.apache.tomcat.util.Constants.LOW_MEMORY) ? "true" : "false")).booleanValue();
protected static final boolean X_POWERED_BY =
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-12 17:58:07 UTC (rev 1673)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-12 21:30:43 UTC (rev 1674)
@@ -333,7 +333,7 @@
* Maximum number of requests which can be performed over a keepalive
* connection. The default is the same as for Apache HTTP Server.
*/
- protected int maxKeepAliveRequests = 100;
+ protected int maxKeepAliveRequests = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 1 : 100;
public int getMaxKeepAliveRequests() { return maxKeepAliveRequests; }
public void setMaxKeepAliveRequests(int mkar) { maxKeepAliveRequests = mkar; }
@@ -550,12 +550,13 @@
protected static class Http11ConnectionHandler implements Handler {
protected Http11Protocol proto;
- protected AtomicLong registerCount = new AtomicLong(0);
+ protected AtomicLong registerCount = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? null : new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentHashMap<Socket, Http11Processor> connections =
new ConcurrentHashMap<Socket, Http11Processor>();
protected ConcurrentLinkedQueue<Http11Processor> recycledProcessors =
+ (org.apache.tomcat.util.Constants.LOW_MEMORY) ? null :
new ConcurrentLinkedQueue<Http11Processor>() {
protected AtomicInteger size = new AtomicInteger(0);
public boolean offer(Http11Processor processor) {
@@ -626,7 +627,9 @@
} finally {
if (state != SocketState.LONG) {
connections.remove(socket);
- recycledProcessors.offer(result);
+ if (recycledProcessors != null) {
+ recycledProcessors.offer(result);
+ }
} else {
if (proto.endpoint.isRunning()) {
proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
@@ -640,7 +643,7 @@
}
public SocketState process(Socket socket) {
- Http11Processor processor = recycledProcessors.poll();
+ Http11Processor processor = (recycledProcessors != null) ? recycledProcessors.poll() : null;
try {
if (processor == null) {
@@ -662,7 +665,7 @@
connections.put(socket, processor);
proto.endpoint.getEventPoller().add(socket, processor.getTimeout(),
processor.getResumeNotification(), false);
- } else {
+ } else if (recycledProcessors != null) {
recycledProcessors.offer(processor);
}
return state;
@@ -688,7 +691,9 @@
Http11Protocol.log.error
(sm.getString("http11protocol.proto.error"), e);
}
- recycledProcessors.offer(processor);
+ if (recycledProcessors != null) {
+ recycledProcessors.offer(processor);
+ }
return SocketState.CLOSED;
}
@@ -708,7 +713,9 @@
processor.setSocketBuffer(proto.socketBuffer);
processor.setMaxSavePostSize(proto.maxSavePostSize);
processor.setServer(proto.server);
- register(processor);
+ if (!org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ register(processor);
+ }
return processor;
}
Modified: trunk/java/org/apache/tomcat/util/buf/StringCache.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/StringCache.java 2011-03-12 17:58:07 UTC (rev 1673)
+++ trunk/java/org/apache/tomcat/util/buf/StringCache.java 2011-03-12 21:30:43 UTC (rev 1674)
@@ -41,7 +41,8 @@
* Enabled ?
*/
protected static boolean byteEnabled =
- ("true".equals(System.getProperty("org.apache.tomcat.util.buf.StringCache.byte.enabled", "true")));
+ ("true".equals(System.getProperty("org.apache.tomcat.util.buf.StringCache.byte.enabled",
+ org.apache.tomcat.util.Constants.LOW_MEMORY ? "false" : "true")));
protected static boolean charEnabled =
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-12 17:58:07 UTC (rev 1673)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-03-12 21:30:43 UTC (rev 1674)
@@ -170,7 +170,7 @@
/**
* Maximum amount of worker threads.
*/
- protected int maxThreads = 32 * Runtime.getRuntime().availableProcessors();
+ protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 32 : 32 * Runtime.getRuntime().availableProcessors();
public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; }
public int getMaxThreads() { return maxThreads; }
@@ -584,10 +584,18 @@
// Poller size defaults
if (pollerSize <= 0) {
- pollerSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (8 * 1024) : (32 * 1024);
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ pollerSize = (1 * 1024);
+ } else {
+ pollerSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (8 * 1024) : (32 * 1024);
+ }
}
if (sendfileSize <= 0) {
- sendfileSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (1 * 1024) : (16 * 1024);
+ if (org.apache.tomcat.util.Constants.LOW_MEMORY) {
+ sendfileSize = 128;
+ } else {
+ sendfileSize = (OS.IS_WIN32 || OS.IS_WIN64) ? (1 * 1024) : (16 * 1024);
+ }
}
long inetAddress = Address.info(addressStr, family,
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-12 17:58:07 UTC (rev 1673)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2011-03-12 21:30:43 UTC (rev 1674)
@@ -155,7 +155,7 @@
/**
* Maximum amount of worker threads.
*/
- protected int maxThreads = 512 * Runtime.getRuntime().availableProcessors();
+ protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 256 : 512 * Runtime.getRuntime().availableProcessors();
public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; }
public int getMaxThreads() { return maxThreads; }
@@ -171,7 +171,7 @@
/**
* Size of the socket poller.
*/
- protected int pollerSize = 32 * 1024;
+ protected int pollerSize = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? (1 * 1024) : (32 * 1024);
public void setPollerSize(int pollerSize) { this.pollerSize = pollerSize; }
public int getPollerSize() { return pollerSize; }
14 years
JBossWeb SVN: r1673 - in trunk/java/org/apache: catalina/core and 6 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-12 12:58:07 -0500 (Sat, 12 Mar 2011)
New Revision: 1673
Added:
trunk/java/org/apache/tomcat/util/Constants.java
Modified:
trunk/java/org/apache/catalina/connector/Connector.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/ContainerBase.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardEngine.java
trunk/java/org/apache/catalina/core/StandardHost.java
trunk/java/org/apache/catalina/core/StandardPipeline.java
trunk/java/org/apache/catalina/core/StandardServer.java
trunk/java/org/apache/catalina/core/StandardService.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/realm/RealmBase.java
trunk/java/org/apache/catalina/session/ManagerBase.java
trunk/java/org/apache/catalina/startup/Embedded.java
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
Log:
- Add a system property to disable the legacy model MBeans. Removing this completely is probably not an option.
Modified: trunk/java/org/apache/catalina/connector/Connector.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Connector.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/connector/Connector.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -409,10 +409,6 @@
* Connector.
*/
public Container getContainer() {
- if( container==null ) {
- // Lazy - maybe it was added later
- findContainer();
- }
return (container);
}
@@ -982,7 +978,7 @@
/**
* Initialize this connector (create ServerSocket here!)
*/
- public void initialize()
+ public void init()
throws LifecycleException
{
if (initialized) {
@@ -993,18 +989,20 @@
this.initialized = true;
- if (oname == null) {
- try {
- // we are loaded directly, via API - and no name was given to us
- oname = createObjectName(container.getName(), "Connector");
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (oname == null) {
+ try {
+ // we are loaded directly, via API - and no name was given to us
+ oname = createObjectName(container.getName(), "Connector");
+ Registry.getRegistry(null, null)
.registerComponent(this, oname, null);
- controller=oname;
- } catch (Exception e) {
- log.error( "Error registering connector ", e);
+ controller=oname;
+ } catch (Exception e) {
+ log.error( "Error registering connector ", e);
+ }
+ if(log.isDebugEnabled())
+ log.debug("Creating name for connector " + oname);
}
- if(log.isDebugEnabled())
- log.debug("Creating name for connector " + oname);
}
// Initializa adapter
@@ -1059,7 +1057,7 @@
*/
public void start() throws LifecycleException {
if( !initialized )
- initialize();
+ init();
// Validate and update our current state
if (started ) {
@@ -1072,19 +1070,21 @@
// We can't register earlier - the JMX registration of this happens
// in Server.start callback
- if ( this.oname != null ) {
- // We are registred - register the adapter as well.
- try {
- Registry.getRegistry(null, null).registerComponent
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if ( this.oname != null ) {
+ // We are registred - register the adapter as well.
+ try {
+ Registry.getRegistry(null, null).registerComponent
(protocolHandler, createObjectName(this.domain,"ProtocolHandler"), null);
- } catch (Exception ex) {
- log.error(sm.getString
- ("coyoteConnector.protocolRegistrationFailed"), ex);
+ } catch (Exception ex) {
+ log.error(sm.getString
+ ("coyoteConnector.protocolRegistrationFailed"), ex);
+ }
+ } else {
+ if(log.isInfoEnabled())
+ log.info(sm.getString
+ ("coyoteConnector.cannotRegisterProtocol"));
}
- } else {
- if(log.isInfoEnabled())
- log.info(sm.getString
- ("coyoteConnector.cannotRegisterProtocol"));
}
try {
@@ -1119,12 +1119,14 @@
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
- try {
- Registry.getRegistry(null, null).unregisterComponent
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ try {
+ Registry.getRegistry(null, null).unregisterComponent
(createObjectName(this.domain,"ProtocolHandler"));
- } catch (MalformedObjectNameException e) {
- log.error( sm.getString
- ("coyoteConnector.protocolUnregistrationFailed"), e);
+ } catch (MalformedObjectNameException e) {
+ log.error( sm.getString
+ ("coyoteConnector.protocolUnregistrationFailed"), e);
+ }
}
try {
protocolHandler.destroy();
@@ -1183,62 +1185,14 @@
}
}
- protected void findContainer() {
- try {
- // Register to the service
- ObjectName parentName=new ObjectName( domain + ":" +
- "type=Service");
-
- if(log.isDebugEnabled())
- log.debug("Adding to " + parentName );
- if( mserver.isRegistered(parentName )) {
- mserver.invoke(parentName, "addConnector", new Object[] { this },
- new String[] {"org.apache.catalina.connector.Connector"});
- // As a side effect we'll get the container field set
- // Also initialize will be called
- //return;
- }
- // XXX Go directly to the Engine
- // initialize(); - is called by addConnector
- ObjectName engName=new ObjectName( domain + ":" + "type=Engine");
- if( mserver.isRegistered(engName )) {
- Object obj=mserver.getAttribute(engName, "managedResource");
+ public void destroy() throws Exception {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname!=null && controller==oname ) {
if(log.isDebugEnabled())
- log.debug("Found engine " + obj + " " + obj.getClass());
- container=(Container)obj;
-
- // Internal initialize - we now have the Engine
- initialize();
-
- if(log.isDebugEnabled())
- log.debug("Initialized");
- // As a side effect we'll get the container field set
- // Also initialize will be called
- return;
+ log.debug("Unregister itself " + oname );
+ Registry.getRegistry(null, null).unregisterComponent(oname);
}
- } catch( Exception ex ) {
- log.error( "Error finding container " + ex);
}
- }
-
- public void init() throws Exception {
-
- if( this.getService() != null ) {
- if(log.isDebugEnabled())
- log.debug( "Already configured" );
- return;
- }
- if( container==null ) {
- findContainer();
- }
- }
-
- public void destroy() throws Exception {
- if( oname!=null && controller==oname ) {
- if(log.isDebugEnabled())
- log.debug("Unregister itself " + oname );
- Registry.getRegistry(null, null).unregisterComponent(oname);
- }
if( getService() == null)
return;
getService().removeConnector(this);
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -447,7 +447,9 @@
filter.init(this);
// Expose filter via JMX
- registerJMX();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ registerJMX();
+ }
return (this.filter);
@@ -485,7 +487,9 @@
*/
void release() {
- unregsiterJMX();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ unregsiterJMX();
+ }
if (this.filter != null)
{
Modified: trunk/java/org/apache/catalina/core/ContainerBase.java
===================================================================
--- trunk/java/org/apache/catalina/core/ContainerBase.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/ContainerBase.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -1164,16 +1164,18 @@
initialized=false;
// unregister this component
- if ( oname != null ) {
- try {
- if( controller == oname ) {
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if ( oname != null ) {
+ try {
+ if( controller == oname ) {
+ Registry.getRegistry(null, null)
.unregisterComponent(oname);
- if(log.isDebugEnabled())
- log.debug("unregistering " + oname);
+ if(log.isDebugEnabled())
+ log.debug("unregistering " + oname);
+ }
+ } catch( Throwable t ) {
+ log.error("Error unregistering ", t );
}
- } catch( Throwable t ) {
- log.error("Error unregistering ", t );
}
}
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -3536,13 +3536,15 @@
((BaseDirContext) webappResources).allocate();
}
// Register the cache in JMX
- if (isCachingAllowed()) {
- ObjectName resourcesName =
- new ObjectName(this.getDomain() + ":type=Cache,host="
- + getHostname() + ",path="
- + (("".equals(getPath()))?"/":getPath()));
- Registry.getRegistry(null, null).registerComponent
- (proxyDirContext.getCache(), resourcesName, null);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (isCachingAllowed()) {
+ ObjectName resourcesName =
+ new ObjectName(this.getDomain() + ":type=Cache,host="
+ + getHostname() + ",path="
+ + (("".equals(getPath()))?"/":getPath()));
+ Registry.getRegistry(null, null).registerComponent
+ (proxyDirContext.getCache(), resourcesName, null);
+ }
}
this.resources = proxyDirContext;
} catch (Throwable t) {
@@ -3571,15 +3573,17 @@
((BaseDirContext) webappResources).release();
}
// Unregister the cache in JMX
- if (isCachingAllowed()) {
- ObjectName resourcesName =
- new ObjectName(this.getDomain()
- + ":type=Cache,host="
- + getHostname() + ",path="
- + (("".equals(getPath()))?"/"
- :getPath()));
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (isCachingAllowed()) {
+ ObjectName resourcesName =
+ new ObjectName(this.getDomain()
+ + ":type=Cache,host="
+ + getHostname() + ",path="
+ + (("".equals(getPath()))?"/"
+ :getPath()));
+ Registry.getRegistry(null, null)
.unregisterComponent(resourcesName);
+ }
}
}
} catch (Throwable t) {
@@ -3657,14 +3661,16 @@
if(log.isDebugEnabled())
log.debug("Starting " + ("".equals(getName()) ? "ROOT" : getName()));
- // Set JMX object name for proper pipeline registration
- preRegisterJMX();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ // Set JMX object name for proper pipeline registration
+ preRegisterJMX();
- if ((oname != null) &&
- (Registry.getRegistry(null, null).getMBeanServer().isRegistered(oname))) {
- // As things depend on the JMX registration, the context
- // must be reregistered again once properly initialized
- Registry.getRegistry(null, null).unregisterComponent(oname);
+ if ((oname != null) &&
+ (Registry.getRegistry(null, null).getMBeanServer().isRegistered(oname))) {
+ // As things depend on the JMX registration, the context
+ // must be reregistered again once properly initialized
+ Registry.getRegistry(null, null).unregisterComponent(oname);
+ }
}
// Notify our interested LifecycleListeners
@@ -3884,7 +3890,9 @@
setStarting(false);
// JMX registration
- registerJMX();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ registerJMX();
+ }
startTime=System.currentTimeMillis();
@@ -4676,60 +4684,6 @@
public synchronized void init() throws Exception {
- if( this.getParent() == null ) {
- ObjectName parentName=getParentName();
-
- if( ! mserver.isRegistered(parentName)) {
- if(log.isDebugEnabled())
- log.debug("No host, creating one " + parentName);
- StandardHost host=new StandardHost();
- host.setName(hostName);
- Registry.getRegistry(null, null)
- .registerComponent(host, parentName, null);
- // We could do it the hard way...
- //mserver.invoke(parentName, "init", new Object[] {}, new String[] {} );
- // or same thing easier:
- host.init();
- }
-
- // Add the main configuration listener
- LifecycleListener config = null;
- try {
- String configClassName = getConfigClass();
- if (configClassName == null) {
- try {
- configClassName = String.valueOf(mserver.getAttribute(parentName, "configClass"));
- } catch (AttributeNotFoundException e) {
- // Ignore, it's normal a host may not have this optional attribute
- }
- }
- if (configClassName != null) {
- Class clazz = Class.forName(configClassName);
- config = (LifecycleListener) clazz.newInstance();
- }
- } catch (Exception e) {
- log.warn("Error creating ContextConfig for " + parentName, e);
- throw e;
- }
- if (config != null) {
- this.addLifecycleListener(config);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("AddChild " + parentName + " " + this);
- }
- try {
- mserver.invoke(parentName, "addChild", new Object[] { this },
- new String[] {"org.apache.catalina.Container"});
- } catch (Exception e) {
- destroy();
- throw e;
- }
- // It's possible that addChild may have started us
- if( initialized ) {
- return;
- }
- }
super.init();
// Notify our interested LifecycleListeners
Modified: trunk/java/org/apache/catalina/core/StandardEngine.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardEngine.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardEngine.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -276,37 +276,39 @@
if( initialized ) return;
initialized=true;
- if( oname==null ) {
- // not registered in JMX yet - standalone mode
- try {
- if (domain==null) {
- domain=getName();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==null ) {
+ // not registered in JMX yet - standalone mode
+ try {
+ if (domain==null) {
+ domain=getName();
+ }
+ if(log.isDebugEnabled())
+ log.debug( "Register " + domain );
+ oname=new ObjectName(domain + ":type=Engine");
+ controller=oname;
+ Registry.getRegistry(null, null)
+ .registerComponent(this, oname, null);
+ } catch( Throwable t ) {
+ log.info("Error registering ", t );
}
- if(log.isDebugEnabled())
- log.debug( "Register " + domain );
- oname=new ObjectName(domain + ":type=Engine");
- controller=oname;
- Registry.getRegistry(null, null)
- .registerComponent(this, oname, null);
- } catch( Throwable t ) {
- log.info("Error registering ", t );
}
- }
- if( mbeansFile == null ) {
- String defaultMBeansFile=getBaseDir() + "/conf/tomcat5-mbeans.xml";
- File f=new File( defaultMBeansFile );
- if( f.exists() ) mbeansFile=f.getAbsolutePath();
- }
- if( mbeansFile != null ) {
- readEngineMbeans();
- }
- if( mbeans != null ) {
- try {
- Registry.getRegistry(null, null).invoke(mbeans, "init", false);
- } catch (Exception e) {
- log.error("Error in init() for " + mbeansFile, e);
+ if( mbeansFile == null ) {
+ String defaultMBeansFile=getBaseDir() + "/conf/tomcat5-mbeans.xml";
+ File f=new File( defaultMBeansFile );
+ if( f.exists() ) mbeansFile=f.getAbsolutePath();
}
+ if( mbeansFile != null ) {
+ readEngineMbeans();
+ }
+ if( mbeans != null ) {
+ try {
+ Registry.getRegistry(null, null).invoke(mbeans, "init", false);
+ } catch (Exception e) {
+ log.error("Error in init() for " + mbeansFile, e);
+ }
+ }
}
// not needed since the following if statement does the same thing the right way
@@ -350,31 +352,32 @@
// this call implizit this.stop()
((StandardService)service).destroy();
- if( mbeans != null ) {
- try {
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( mbeans != null ) {
+ try {
+ Registry.getRegistry(null, null)
.invoke(mbeans, "destroy", false);
- } catch (Exception e) {
- log.error(sm.getString("standardEngine.unregister.mbeans.failed" ,mbeansFile), e);
+ } catch (Exception e) {
+ log.error(sm.getString("standardEngine.unregister.mbeans.failed" ,mbeansFile), e);
+ }
}
- }
- //
- if( mbeans != null ) {
- try {
- for( int i=0; i<mbeans.size() ; i++ ) {
- Registry.getRegistry(null, null)
+ //
+ if( mbeans != null ) {
+ try {
+ for( int i=0; i<mbeans.size() ; i++ ) {
+ Registry.getRegistry(null, null)
.unregisterComponent((ObjectName)mbeans.get(i));
+ }
+ } catch (Exception e) {
+ log.error(sm.getString("standardEngine.unregister.mbeans.failed", mbeansFile), e);
}
- } catch (Exception e) {
- log.error(sm.getString("standardEngine.unregister.mbeans.failed", mbeansFile), e);
}
- }
-
- // force all metadata to be reloaded.
- // That doesn't affect existing beans. We should make it per
- // registry - and stop using the static.
- Registry.getRegistry(null, null).resetMetadata();
-
+
+ // force all metadata to be reloaded.
+ // That doesn't affect existing beans. We should make it per
+ // registry - and stop using the static.
+ Registry.getRegistry(null, null).resetMetadata();
+ }
}
/**
@@ -390,29 +393,31 @@
init();
}
- // Look for a realm - that may have been configured earlier.
- // If the realm is added after context - it'll set itself.
- if( realm == null ) {
- ObjectName realmName=null;
- try {
- realmName=new ObjectName( domain + ":type=Realm");
- if( mserver.isRegistered(realmName ) ) {
- mserver.invoke(realmName, "init",
- new Object[] {},
- new String[] {}
- );
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ // Look for a realm - that may have been configured earlier.
+ // If the realm is added after context - it'll set itself.
+ if( realm == null ) {
+ ObjectName realmName=null;
+ try {
+ realmName=new ObjectName( domain + ":type=Realm");
+ if( mserver.isRegistered(realmName ) ) {
+ mserver.invoke(realmName, "init",
+ new Object[] {},
+ new String[] {}
+ );
+ }
+ } catch( Throwable t ) {
+ log.debug("No realm for this engine " + realmName);
}
- } catch( Throwable t ) {
- log.debug("No realm for this engine " + realmName);
}
- }
-
- if( mbeans != null ) {
- try {
- Registry.getRegistry(null, null)
+
+ if( mbeans != null ) {
+ try {
+ Registry.getRegistry(null, null)
.invoke(mbeans, "start", false);
- } catch (Exception e) {
- log.error("Error in start() for " + mbeansFile, e);
+ } catch (Exception e) {
+ log.error("Error in start() for " + mbeansFile, e);
+ }
}
}
@@ -423,11 +428,13 @@
public void stop() throws LifecycleException {
super.stop();
- if( mbeans != null ) {
- try {
- Registry.getRegistry(null, null).invoke(mbeans, "stop", false);
- } catch (Exception e) {
- log.error("Error in stop() for " + mbeansFile, e);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( mbeans != null ) {
+ try {
+ Registry.getRegistry(null, null).invoke(mbeans, "stop", false);
+ } catch (Exception e) {
+ log.error("Error in stop() for " + mbeansFile, e);
+ }
}
}
}
Modified: trunk/java/org/apache/catalina/core/StandardHost.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHost.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardHost.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -524,20 +524,22 @@
}
}
- if( oname==null ) {
- // not registered in JMX yet - standalone mode
- try {
- StandardEngine engine=(StandardEngine)parent;
- domain=engine.getName();
- if(log.isDebugEnabled())
- log.debug( "Register host " + getName() + " with domain "+ domain );
- oname=new ObjectName(domain + ":type=Host,host=" +
- this.getName());
- controller = oname;
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==null ) {
+ // not registered in JMX yet - standalone mode
+ try {
+ StandardEngine engine=(StandardEngine)parent;
+ domain=engine.getName();
+ if(log.isDebugEnabled())
+ log.debug( "Register host " + getName() + " with domain "+ domain );
+ oname=new ObjectName(domain + ":type=Host,host=" +
+ this.getName());
+ controller = oname;
+ Registry.getRegistry(null, null)
.registerComponent(this, oname, null);
- } catch( Throwable t ) {
- log.error("Host registering failed!", t );
+ } catch( Throwable t ) {
+ log.error("Host registering failed!", t );
+ }
}
}
}
Modified: trunk/java/org/apache/catalina/core/StandardPipeline.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardPipeline.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardPipeline.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -233,7 +233,9 @@
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).start();
- registerValve(current);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ registerValve(current);
+ }
current = current.getNext();
}
@@ -315,20 +317,22 @@
}
private void unregisterValve(Valve valve) {
- if( valve instanceof ValveBase ) {
- try {
- ValveBase vb=(ValveBase)valve;
- if( vb.getController()!=null &&
- vb.getController() ==
- ((ContainerBase)container).getJmxName() ) {
-
- ObjectName vname=vb.getObjectName();
- Registry.getRegistry(null, null).getMBeanServer()
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( valve instanceof ValveBase ) {
+ try {
+ ValveBase vb=(ValveBase)valve;
+ if( vb.getController()!=null &&
+ vb.getController() ==
+ ((ContainerBase)container).getJmxName() ) {
+
+ ObjectName vname=vb.getObjectName();
+ Registry.getRegistry(null, null).getMBeanServer()
.unregisterMBean(vname);
- ((ValveBase)valve).setObjectName(null);
+ ((ValveBase)valve).setObjectName(null);
+ }
+ } catch( Throwable t ) {
+ log.info( "Can't unregister valve " + valve , t );
}
- } catch( Throwable t ) {
- log.info( "Can't unregister valve " + valve , t );
}
}
}
@@ -449,7 +453,9 @@
}
}
// Register the newly added valve
- registerValve(valve);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ registerValve(valve);
+ }
}
// Add this Valve to the set associated with this Pipeline
Modified: trunk/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardServer.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardServer.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -418,25 +418,27 @@
lifecycle.fireLifecycleEvent(INIT_EVENT, null);
initialized = true;
- if( oname==null ) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==null ) {
+ try {
+ oname=new ObjectName( "Catalina:type=Server");
+ Registry.getRegistry(null, null)
+ .registerComponent(this, oname, null );
+ } catch (Exception e) {
+ log.error("Error registering ",e);
+ }
+ }
+
+ // Register global String cache
try {
- oname=new ObjectName( "Catalina:type=Server");
+ ObjectName oname2 =
+ new ObjectName(oname.getDomain() + ":type=StringCache");
Registry.getRegistry(null, null)
- .registerComponent(this, oname, null );
+ .registerComponent(new StringCache(), oname2, null );
} catch (Exception e) {
log.error("Error registering ",e);
}
}
-
- // Register global String cache
- try {
- ObjectName oname2 =
- new ObjectName(oname.getDomain() + ":type=StringCache");
- Registry.getRegistry(null, null)
- .registerComponent(new StringCache(), oname2, null );
- } catch (Exception e) {
- log.error("Error registering ",e);
- }
// Initialize our defined Services
for (int i = 0; i < services.length; i++) {
Modified: trunk/java/org/apache/catalina/core/StandardService.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardService.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardService.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -348,7 +348,7 @@
if (initialized) {
try {
- connector.initialize();
+ connector.init();
} catch (LifecycleException e) {
log.error("Connector.initialize", e);
}
@@ -682,23 +682,24 @@
}
}
- if( oname==controller ) {
- // we registered ourself on init().
- // That should be the typical case - this object is just for
- // backward compat, nobody should bother to load it explicitely
- Registry.getRegistry(null, null).unregisterComponent(oname);
- Executor[] executors = findExecutors();
- for (int i = 0; i < executors.length; i++) {
- try {
- ObjectName executorObjectName =
- new ObjectName(domain + ":type=Executor,name=" + executors[i].getName());
- Registry.getRegistry(null, null).unregisterComponent(executorObjectName);
- } catch (Exception e) {
- // Ignore (invalid ON, which cannot happen)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==controller ) {
+ // we registered ourself on init().
+ // That should be the typical case - this object is just for
+ // backward compat, nobody should bother to load it explicitely
+ Registry.getRegistry(null, null).unregisterComponent(oname);
+ Executor[] executors = findExecutors();
+ for (int i = 0; i < executors.length; i++) {
+ try {
+ ObjectName executorObjectName =
+ new ObjectName(domain + ":type=Executor,name=" + executors[i].getName());
+ Registry.getRegistry(null, null).unregisterComponent(executorObjectName);
+ } catch (Exception e) {
+ // Ignore (invalid ON, which cannot happen)
+ }
}
}
- }
-
+ }
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
@@ -721,29 +722,29 @@
}
initialized = true;
- if( oname==null ) {
- try {
- // Hack - Server should be deprecated...
- Container engine=this.getContainer();
- domain=engine.getName();
- oname=new ObjectName(domain + ":type=Service,serviceName="+name);
- this.controller=oname;
- Registry.getRegistry(null, null)
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==null ) {
+ try {
+ // Hack - Server should be deprecated...
+ Container engine=this.getContainer();
+ domain=engine.getName();
+ oname=new ObjectName(domain + ":type=Service,serviceName="+name);
+ this.controller=oname;
+ Registry.getRegistry(null, null)
.registerComponent(this, oname, null);
-
- Executor[] executors = findExecutors();
- for (int i = 0; i < executors.length; i++) {
- ObjectName executorObjectName =
- new ObjectName(domain + ":type=Executor,name=" + executors[i].getName());
- Registry.getRegistry(null, null)
+
+ Executor[] executors = findExecutors();
+ for (int i = 0; i < executors.length; i++) {
+ ObjectName executorObjectName =
+ new ObjectName(domain + ":type=Executor,name=" + executors[i].getName());
+ Registry.getRegistry(null, null)
.registerComponent(executors[i], executorObjectName, null);
+ }
+
+ } catch (Exception e) {
+ log.error(sm.getString("standardService.register.failed",domain),e);
}
-
- } catch (Exception e) {
- log.error(sm.getString("standardService.register.failed",domain),e);
}
-
-
}
if( server==null ) {
// If no server was defined - create one
@@ -756,7 +757,7 @@
// Initialize our defined Connectors
synchronized (connectors) {
for (int i = 0; i < connectors.length; i++) {
- connectors[i].initialize();
+ connectors[i].init();
}
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -1644,8 +1644,10 @@
// Start up this component
super.start();
- if( oname != null )
- registerJMX((StandardContext)getParent());
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname != null )
+ registerJMX((StandardContext)getParent());
+ }
// Load and initialize an instance of this servlet if requested
// MOVED TO StandardContext START() METHOD
@@ -1700,18 +1702,20 @@
broadcaster.sendNotification(notification);
}
- if( oname != null ) {
- Registry.getRegistry(null, null).unregisterComponent(oname);
-
- // Send j2ee.object.deleted notification
- Notification notification =
- new Notification("j2ee.object.deleted", this.getObjectName(),
- sequenceNumber++);
- broadcaster.sendNotification(notification);
- }
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname != null ) {
+ Registry.getRegistry(null, null).unregisterComponent(oname);
- if (isJspServlet && jspMonitorON != null ) {
- Registry.getRegistry(null, null).unregisterComponent(jspMonitorON);
+ // Send j2ee.object.deleted notification
+ Notification notification =
+ new Notification("j2ee.object.deleted", this.getObjectName(),
+ sequenceNumber++);
+ broadcaster.sendNotification(notification);
+ }
+
+ if (isJspServlet && jspMonitorON != null ) {
+ Registry.getRegistry(null, null).unregisterComponent(jspMonitorON);
+ }
}
}
Modified: trunk/java/org/apache/catalina/realm/RealmBase.java
===================================================================
--- trunk/java/org/apache/catalina/realm/RealmBase.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/realm/RealmBase.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -1091,15 +1091,17 @@
public void destroy() {
- // unregister this realm
- if ( oname!=null ) {
- try {
- Registry.getRegistry(null, null).unregisterComponent(oname);
- if(log.isDebugEnabled())
- log.debug( "unregistering realm " + oname );
- } catch( Exception ex ) {
- log.error( "Can't unregister realm " + oname, ex);
- }
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ // unregister this realm
+ if ( oname!=null ) {
+ try {
+ Registry.getRegistry(null, null).unregisterComponent(oname);
+ if(log.isDebugEnabled())
+ log.debug( "unregistering realm " + oname );
+ } catch( Exception ex ) {
+ log.error( "Can't unregister realm " + oname, ex);
+ }
+ }
}
}
@@ -1380,44 +1382,46 @@
if( initialized && container != null ) return;
initialized=true;
- if( container== null ) {
- ObjectName parent=null;
- // Register with the parent
- try {
- if( host == null ) {
- // global
- parent=new ObjectName(domain +":type=Engine");
- } else if( path==null ) {
- parent=new ObjectName(domain +
- ":type=Host,host=" + host);
- } else {
- parent=new ObjectName(domain +":j2eeType=WebModule,name=//" +
- host + path);
+
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( container== null ) {
+ ObjectName parent=null;
+ // Register with the parent
+ try {
+ if( host == null ) {
+ // global
+ parent=new ObjectName(domain +":type=Engine");
+ } else if( path==null ) {
+ parent=new ObjectName(domain +
+ ":type=Host,host=" + host);
+ } else {
+ parent=new ObjectName(domain +":j2eeType=WebModule,name=//" +
+ host + path);
+ }
+ if( mserver.isRegistered(parent )) {
+ if(log.isDebugEnabled())
+ log.debug("Register with " + parent);
+ mserver.setAttribute(parent, new Attribute("realm", this));
+ }
+ } catch (Exception e) {
+ log.error("Parent not available yet: " + parent);
}
- if( mserver.isRegistered(parent )) {
+ }
+
+ if( oname==null ) {
+ // register
+ try {
+ ContainerBase cb=(ContainerBase)container;
+ oname=new ObjectName(cb.getDomain()+":type=Realm" +
+ getRealmSuffix() + cb.getContainerSuffix());
+ Registry.getRegistry(null, null).registerComponent(this, oname, null );
if(log.isDebugEnabled())
- log.debug("Register with " + parent);
- mserver.setAttribute(parent, new Attribute("realm", this));
+ log.debug("Register Realm "+oname);
+ } catch (Throwable e) {
+ log.error( "Can't register " + oname, e);
}
- } catch (Exception e) {
- log.error("Parent not available yet: " + parent);
}
}
-
- if( oname==null ) {
- // register
- try {
- ContainerBase cb=(ContainerBase)container;
- oname=new ObjectName(cb.getDomain()+":type=Realm" +
- getRealmSuffix() + cb.getContainerSuffix());
- Registry.getRegistry(null, null).registerComponent(this, oname, null );
- if(log.isDebugEnabled())
- log.debug("Register Realm "+oname);
- } catch (Throwable e) {
- log.error( "Can't register " + oname, e);
- }
- }
-
}
protected String getRealmSuffix() {
Modified: trunk/java/org/apache/catalina/session/ManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/ManagerBase.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/session/ManagerBase.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -399,8 +399,10 @@
}
public void destroy() {
- if( oname != null )
- Registry.getRegistry(null, null).unregisterComponent(oname);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname != null )
+ Registry.getRegistry(null, null).unregisterComponent(oname);
+ }
initialized=false;
oname = null;
}
@@ -411,22 +413,24 @@
log = Logger.getLogger(ManagerBase.class);
- if( oname==null ) {
- try {
- StandardContext ctx=(StandardContext)this.getContainer();
- Engine eng=(Engine)ctx.getParent().getParent();
- domain=ctx.getEngineName();
- distributable = ctx.getDistributable();
- StandardHost hst=(StandardHost)ctx.getParent();
- String path = ctx.getPath();
- if (path.equals("")) {
- path = "/";
- }
- oname=new ObjectName(domain + ":type=Manager,path="
- + path + ",host=" + hst.getName());
- Registry.getRegistry(null, null).registerComponent(this, oname, null );
- } catch (Exception e) {
- log.error("Error registering ",e);
+ StandardContext ctx=(StandardContext)this.getContainer();
+ distributable = ctx.getDistributable();
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( oname==null ) {
+ try {
+ Engine eng=(Engine)ctx.getParent().getParent();
+ domain=ctx.getEngineName();
+ StandardHost hst=(StandardHost)ctx.getParent();
+ String path = ctx.getPath();
+ if (path.equals("")) {
+ path = "/";
+ }
+ oname=new ObjectName(domain + ":type=Manager,path="
+ + path + ",host=" + hst.getName());
+ Registry.getRegistry(null, null).registerComponent(this, oname, null );
+ } catch (Exception e) {
+ log.error("Error registering ",e);
+ }
}
}
Modified: trunk/java/org/apache/catalina/startup/Embedded.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Embedded.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/catalina/startup/Embedded.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -724,7 +724,7 @@
// Start our defined Connectors second
for (int i = 0; i < connectors.length; i++) {
- connectors[i].initialize();
+ connectors[i].init();
if (connectors[i] instanceof Lifecycle)
((Lifecycle) connectors[i]).start();
}
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -181,19 +181,21 @@
public void start() throws Exception {
- if (this.domain != null ) {
- try {
- tpOname = new ObjectName
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (this.domain != null ) {
+ try {
+ tpOname = new ObjectName
(domain + ":" + "type=ThreadPool,name=" + getName());
- Registry.getRegistry(null, null)
+ Registry.getRegistry(null, null)
.registerComponent(endpoint, tpOname, null );
- } catch (Exception e) {
- log.error("Can't register threadpool" );
- }
- rgOname = new ObjectName
+ } catch (Exception e) {
+ log.error("Can't register threadpool" );
+ }
+ rgOname = new ObjectName
(domain + ":type=GlobalRequestProcessor,name=" + getName());
- Registry.getRegistry(null, null).registerComponent
+ Registry.getRegistry(null, null).registerComponent
(cHandler.global, rgOname, null);
+ }
}
try {
@@ -270,10 +272,12 @@
throw ex;
}
}
- if (tpOname!=null)
- Registry.getRegistry(null, null).unregisterComponent(tpOname);
- if (rgOname != null)
- Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (tpOname!=null)
+ Registry.getRegistry(null, null).unregisterComponent(tpOname);
+ if (rgOname != null)
+ Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ }
}
// *
@@ -519,7 +523,7 @@
}
protected void register(AjpAprProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
@@ -541,7 +545,7 @@
}
protected void unregister(AjpAprProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
RequestInfo rp = processor.getRequest().getRequestProcessor();
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -178,21 +178,22 @@
public void start() throws Exception {
- if (this.domain != null ) {
- try {
- tpOname = new ObjectName
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (this.domain != null ) {
+ try {
+ tpOname = new ObjectName
(domain + ":" + "type=ThreadPool,name=" + getName());
- Registry.getRegistry(null, null)
+ Registry.getRegistry(null, null)
.registerComponent(endpoint, tpOname, null );
- } catch (Exception e) {
- log.error("Can't register threadpool" );
- }
- rgOname = new ObjectName
+ } catch (Exception e) {
+ log.error("Can't register threadpool" );
+ }
+ rgOname = new ObjectName
(domain + ":type=GlobalRequestProcessor,name=" + getName());
- Registry.getRegistry(null, null).registerComponent
+ Registry.getRegistry(null, null).registerComponent
(cHandler.global, rgOname, null);
+ }
}
-
try {
endpoint.start();
} catch (Exception ex) {
@@ -248,10 +249,12 @@
if (log.isInfoEnabled())
log.info(sm.getString("ajpprotocol.stop", getName()));
endpoint.destroy();
- if (tpOname!=null)
- Registry.getRegistry(null, null).unregisterComponent(tpOname);
- if (rgOname != null)
- Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (tpOname!=null)
+ Registry.getRegistry(null, null).unregisterComponent(tpOname);
+ if (rgOname != null)
+ Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ }
}
// *
@@ -483,7 +486,7 @@
}
protected void register(AjpProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
@@ -505,7 +508,7 @@
}
protected void unregister(AjpProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
RequestInfo rp = processor.getRequest().getRequestProcessor();
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -128,21 +128,22 @@
ObjectName rgOname;
public void start() throws Exception {
- if( this.domain != null ) {
- try {
- tpOname=new ObjectName
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( this.domain != null ) {
+ try {
+ tpOname=new ObjectName
(domain + ":" + "type=ThreadPool,name=" + getName());
- Registry.getRegistry(null, null)
- .registerComponent(endpoint, tpOname, null );
- } catch (Exception e) {
- log.error("Can't register threadpool" );
- }
- rgOname=new ObjectName
+ Registry.getRegistry(null, null)
+ .registerComponent(endpoint, tpOname, null );
+ } catch (Exception e) {
+ log.error("Can't register threadpool" );
+ }
+ rgOname=new ObjectName
(domain + ":type=GlobalRequestProcessor,name=" + getName());
- Registry.getRegistry(null, null).registerComponent
+ Registry.getRegistry(null, null).registerComponent
( cHandler.global, rgOname, null );
+ }
}
-
try {
endpoint.start();
} catch (Exception ex) {
@@ -217,10 +218,12 @@
throw ex;
}
}
- if( tpOname!=null )
- Registry.getRegistry(null, null).unregisterComponent(tpOname);
- if( rgOname != null )
- Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if( tpOname!=null )
+ Registry.getRegistry(null, null).unregisterComponent(tpOname);
+ if( rgOname != null )
+ Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ }
}
public String getName() {
@@ -681,7 +684,7 @@
}
protected void register(Http11AprProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
@@ -703,7 +706,7 @@
}
protected void unregister(Http11AprProcessor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
RequestInfo rp = processor.getRequest().getRequestProcessor();
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-04 00:39:31 UTC (rev 1672)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -194,21 +194,22 @@
}
public void start() throws Exception {
- if (this.domain != null) {
- try {
- tpOname = new ObjectName
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (this.domain != null) {
+ try {
+ tpOname = new ObjectName
(domain + ":" + "type=ThreadPool,name=" + getName());
- Registry.getRegistry(null, null)
+ Registry.getRegistry(null, null)
.registerComponent(endpoint, tpOname, null );
- } catch (Exception e) {
- log.error("Can't register endpoint");
- }
- rgOname=new ObjectName
+ } catch (Exception e) {
+ log.error("Can't register endpoint");
+ }
+ rgOname=new ObjectName
(domain + ":type=GlobalRequestProcessor,name=" + getName());
- Registry.getRegistry(null, null).registerComponent
+ Registry.getRegistry(null, null).registerComponent
( cHandler.global, rgOname, null );
+ }
}
-
try {
endpoint.start();
} catch (Exception ex) {
@@ -264,10 +265,12 @@
if (log.isInfoEnabled())
log.info(sm.getString("http11protocol.stop", getName()));
endpoint.destroy();
- if (tpOname!=null)
- Registry.getRegistry(null, null).unregisterComponent(tpOname);
- if (rgOname != null)
- Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
+ if (tpOname!=null)
+ Registry.getRegistry(null, null).unregisterComponent(tpOname);
+ if (rgOname != null)
+ Registry.getRegistry(null, null).unregisterComponent(rgOname);
+ }
}
public String getName() {
@@ -710,7 +713,7 @@
}
protected void register(Http11Processor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
long count = registerCount.incrementAndGet();
@@ -732,7 +735,7 @@
}
protected void unregister(Http11Processor processor) {
- if (proto.getDomain() != null) {
+ if (org.apache.tomcat.util.Constants.ENABLE_MODELER && proto.getDomain() != null) {
synchronized (this) {
try {
RequestInfo rp = processor.getRequest().getRequestProcessor();
Added: trunk/java/org/apache/tomcat/util/Constants.java
===================================================================
--- trunk/java/org/apache/tomcat/util/Constants.java (rev 0)
+++ trunk/java/org/apache/tomcat/util/Constants.java 2011-03-12 17:58:07 UTC (rev 1673)
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tomcat.util;
+
+/**
+ * Constants.
+ *
+ * @author Remy Maucherat
+ */
+public final class Constants {
+
+ public static final boolean ENABLE_MODELER = Boolean.valueOf(System.getProperty(
+ "org.apache.tomcat.util.ENABLE_MODELER", "false")).booleanValue();
+ public static final boolean LOW_MEMORY = Boolean.valueOf(System.getProperty(
+ "org.apache.tomcat.util.LOW_MEMORY", "false")).booleanValue();
+
+}
14 years
JBossWeb SVN: r1672 - trunk/java/org/apache/catalina/session and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-03-03 19:39:31 -0500 (Thu, 03 Mar 2011)
New Revision: 1672
Modified:
branches/3.0.x/java/org/apache/catalina/session/StoreBase.java
trunk/java/org/apache/catalina/session/StoreBase.java
Log:
- Fix bad Tomcat port (not totally accurate but probably good enough).
Modified: branches/3.0.x/java/org/apache/catalina/session/StoreBase.java
===================================================================
--- branches/3.0.x/java/org/apache/catalina/session/StoreBase.java 2011-03-01 13:20:02 UTC (rev 1671)
+++ branches/3.0.x/java/org/apache/catalina/session/StoreBase.java 2011-03-04 00:39:31 UTC (rev 1672)
@@ -197,7 +197,7 @@
if (session == null) {
continue;
}
- int timeIdle = (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+ int timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle < session.getMaxInactiveInterval()) {
continue;
}
Modified: trunk/java/org/apache/catalina/session/StoreBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/StoreBase.java 2011-03-01 13:20:02 UTC (rev 1671)
+++ trunk/java/org/apache/catalina/session/StoreBase.java 2011-03-04 00:39:31 UTC (rev 1672)
@@ -197,7 +197,7 @@
if (session == null) {
continue;
}
- int timeIdle = (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+ int timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle < session.getMaxInactiveInterval()) {
continue;
}
14 years