Author: jfrederic.clere(a)jboss.com
Date: 2011-04-21 10:10:45 -0400 (Thu, 21 Apr 2011)
New Revision: 1711
Modified:
branches/2.1.x/java/org/apache/coyote/ajp/AjpAprProtocol.java
branches/2.1.x/java/org/apache/coyote/ajp/LocalStrings.properties
branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java
branches/2.1.x/java/org/apache/coyote/http11/LocalStrings.properties
branches/2.1.x/webapps/docs/changelog.xml
Log:
Fix for JBWEB-186.
Modified: branches/2.1.x/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-04-20 23:23:27 UTC
(rev 1710)
+++ branches/2.1.x/java/org/apache/coyote/ajp/AjpAprProtocol.java 2011-04-21 14:10:45 UTC
(rev 1711)
@@ -110,6 +110,9 @@
private AjpConnectionHandler cHandler;
+ private boolean canDestroy = false;
+
+
// --------------------------------------------------------- Public Methods
@@ -201,6 +204,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;
@@ -219,6 +223,9 @@
break;
}
}
+ if (done) {
+ canDestroy = true;
+ }
}
if (log.isInfoEnabled())
log.info(sm.getString("ajpprotocol.pause", getName()));
@@ -238,7 +245,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: branches/2.1.x/java/org/apache/coyote/ajp/LocalStrings.properties
===================================================================
--- branches/2.1.x/java/org/apache/coyote/ajp/LocalStrings.properties 2011-04-20 23:23:27
UTC (rev 1710)
+++ branches/2.1.x/java/org/apache/coyote/ajp/LocalStrings.properties 2011-04-21 14:10:45
UTC (rev 1711)
@@ -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: branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-04-20
23:23:27 UTC (rev 1710)
+++ branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java 2011-04-21
14:10:45 UTC (rev 1711)
@@ -95,6 +95,7 @@
public void setAdapter(Adapter adapter) { this.adapter = adapter; }
public Adapter getAdapter() { return adapter; }
+ private boolean canDestroy = false;
/** Start the protocol
*/
@@ -149,6 +150,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;
@@ -167,6 +169,9 @@
break;
}
}
+ if (done) {
+ canDestroy = true;
+ }
}
if(log.isInfoEnabled())
log.info(sm.getString("http11protocol.pause", getName()));
@@ -186,7 +191,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: branches/2.1.x/java/org/apache/coyote/http11/LocalStrings.properties
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/LocalStrings.properties 2011-04-20
23:23:27 UTC (rev 1710)
+++ branches/2.1.x/java/org/apache/coyote/http11/LocalStrings.properties 2011-04-21
14:10:45 UTC (rev 1711)
@@ -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: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2011-04-20 23:23:27 UTC (rev 1710)
+++ branches/2.1.x/webapps/docs/changelog.xml 2011-04-21 14:10:45 UTC (rev 1711)
@@ -23,6 +23,13 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ <jboss-jira>JBWEB-186</jboss-jira>: Using the native connector causes
the JVM to crash when shutting down on Windows. (remm)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="JBoss Web 2.1.11.GA (remm)">
@@ -1951,7 +1958,7 @@
<bug>41289</bug>: Create configBase, since it is no longer created
elsewhere.
Submitted by Shiva Kumar H R. (remm)
</fix>
- </changelog>
+ </changelog>
</subsection>
<subsection name="Coyote">
<changelog>
Show replies by date