Author: remy.maucherat(a)jboss.com
Date: 2011-02-10 10:47:18 -0500 (Thu, 10 Feb 2011)
New Revision: 1657
Modified:
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/LocalStrings.properties
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/LocalStrings.properties
trunk/webapps/docs/changelog.xml
Log:
- Experiment with skipping destroy (and debug logging) if some processors are still
active.
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-02-10 15:07:42 UTC (rev
1656)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-02-10 15:47:18 UTC (rev
1657)
@@ -114,6 +114,9 @@
private AjpConnectionHandler cHandler;
+ private boolean canDestroy = false;
+
+
// --------------------------------------------------------- Public Methods
@@ -210,6 +213,7 @@
log.error(sm.getString("ajpprotocol.endpoint.pauseerror"), ex);
throw ex;
}
+ canDestroy = false;
// Wait for a while until all the processors are idle
RequestInfo[] states = cHandler.global.getRequestProcessors();
int retry = 0;
@@ -228,6 +232,9 @@
break;
}
}
+ if (done) {
+ canDestroy = true;
+ }
}
if (log.isInfoEnabled())
log.info(sm.getString("ajpprotocol.pause", getName()));
@@ -247,7 +254,22 @@
public void destroy() throws Exception {
if (log.isInfoEnabled())
log.info(sm.getString("ajpprotocol.stop", getName()));
- endpoint.destroy();
+ if (canDestroy) {
+ endpoint.destroy();
+ } else {
+ log.warn(sm.getString("ajpprotocol.cannotDestroy", getName()));
+ try {
+ RequestInfo[] states = cHandler.global.getRequestProcessors();
+ for (int i = 0; i < states.length; i++) {
+ if (states[i].getStage() ==
org.apache.coyote.Constants.STAGE_SERVICE) {
+ // FIXME: Log RequestInfo content
+ }
+ }
+ } catch (Exception ex) {
+ log.error(sm.getString("ajpprotocol.cannotDestroy", getName()),
ex);
+ throw ex;
+ }
+ }
if (tpOname!=null)
Registry.getRegistry(null, null).unregisterComponent(tpOname);
if (rgOname != null)
Modified: trunk/java/org/apache/coyote/ajp/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/coyote/ajp/LocalStrings.properties 2011-02-10 15:07:42 UTC (rev
1656)
+++ trunk/java/org/apache/coyote/ajp/LocalStrings.properties 2011-02-10 15:47:18 UTC (rev
1657)
@@ -16,6 +16,7 @@
ajpprotocol.setattribute=Attribute {0}: {1}
ajpprotocol.start=Starting Coyote AJP/1.3 on {0}
ajpprotocol.stop=Stopping Coyote AJP/1.3 on {0}
+ajpprotocol.cannotDestroy=Skip destroy for Coyote AJP/1.3 on {0} due to active request
processors
ajpprotocol.pause=Pausing Coyote AJP/1.3 on {0}
ajpprotocol.endpoint.pauseerror=Error pausing endpoint
ajpprotocol.resume=Resuming Coyote AJP/1.3 on {0}
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-02-10 15:07:42 UTC
(rev 1656)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-02-10 15:47:18 UTC
(rev 1657)
@@ -99,7 +99,9 @@
public void setAdapter(Adapter adapter) { this.adapter = adapter; }
public Adapter getAdapter() { return adapter; }
+ private boolean canDestroy = false;
+
public boolean hasIoEvents() {
return true;
}
@@ -158,6 +160,7 @@
log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
throw ex;
}
+ canDestroy = false;
// Wait for a while until all the processors are idle
RequestInfo[] states = cHandler.global.getRequestProcessors();
int retry = 0;
@@ -176,6 +179,9 @@
break;
}
}
+ if (done) {
+ canDestroy = true;
+ }
}
if(log.isInfoEnabled())
log.info(sm.getString("http11protocol.pause", getName()));
@@ -195,7 +201,22 @@
public void destroy() throws Exception {
if(log.isInfoEnabled())
log.info(sm.getString("http11protocol.stop", getName()));
- endpoint.destroy();
+ if (canDestroy) {
+ endpoint.destroy();
+ } else {
+ log.warn(sm.getString("http11protocol.cannotDestroy", getName()));
+ try {
+ RequestInfo[] states = cHandler.global.getRequestProcessors();
+ for (int i = 0; i < states.length; i++) {
+ if (states[i].getStage() ==
org.apache.coyote.Constants.STAGE_SERVICE) {
+ // FIXME: Log RequestInfo content
+ }
+ }
+ } catch (Exception ex) {
+ log.error(sm.getString("http11protocol.cannotDestroy",
getName()), ex);
+ throw ex;
+ }
+ }
if( tpOname!=null )
Registry.getRegistry(null, null).unregisterComponent(tpOname);
if( rgOname != null )
Modified: trunk/java/org/apache/coyote/http11/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/coyote/http11/LocalStrings.properties 2011-02-10 15:07:42 UTC
(rev 1656)
+++ trunk/java/org/apache/coyote/http11/LocalStrings.properties 2011-02-10 15:47:18 UTC
(rev 1657)
@@ -21,6 +21,7 @@
http11protocol.socketfactory.initerror=Error initializing socket factory
http11protocol.start=Starting Coyote HTTP/1.1 on {0}
http11protocol.stop=Stopping Coyote HTTP/1.1 on {0}
+http11protocol.cannotDestroy=Skip destroy for Coyote HTTP/1.1 on {0} due to active
request processors
http11protocol.pause=Pausing Coyote HTTP/1.1 on {0}
http11protocol.endpoint.pauseerror=Error pausing endpoint
http11protocol.resume=Resuming Coyote HTTP/1.1 on {0}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-02-10 15:07:42 UTC (rev 1656)
+++ trunk/webapps/docs/changelog.xml 2011-02-10 15:47:18 UTC (rev 1657)
@@ -23,7 +23,10 @@
<bug>50747</bug>: Allow setting content-length when using a writer,
as the previous check
was incomplete. (markt)
</fix>
- </changelog>
+ <fix>
+ Work directory was not set as a read only attribute. (markt)
+ </fix>
+ </changelog>
</subsection>
<subsection name="Coyote">
<changelog>
Show replies by date