Author: kkolinko Date: Mon May 19 13:11:28 2014 New Revision: 1595887 URL: http://svn.apache.org/r1595887 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56399 Improve implementation of CoyoteAdapter.checkRecycled() to do not use an exception for flow control.
Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1595887&r1=1595886&r2=1595887&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Mon May 19 13:11:28 2014 @@ -664,26 +664,31 @@ public class CoyoteAdapter implements Ad org.apache.coyote.Response res) { Request request = (Request) req.getNote(ADAPTER_NOTES); Response response = (Response) res.getNote(ADAPTER_NOTES); - try { - if (request != null && request.getHost() != null) { - throw new RecycleRequiredException(); - } - if (response != null && response.getContentWritten() != 0) { - throw new RecycleRequiredException(); - } - } catch (RecycleRequiredException e) { - String message = sm.getString("coyoteAdapter.checkRecycled"); + String messageKey = null; + if (request != null && request.getHost() != null) { + messageKey = "coyoteAdapter.checkRecycled.request"; + } else if (response != null && response.getContentWritten() != 0) { + messageKey = "coyoteAdapter.checkRecycled.response"; + } + if (messageKey != null) { + // Log this request, as it has probably skipped the access log. + // The log() method will take care of recycling. + log(req, res, 0L); + if (connector.getState().isAvailable()) { - log.info(message, e); + if (log.isInfoEnabled()) { + log.info(sm.getString(messageKey), + new RecycleRequiredException()); + } } else { // There may be some aborted requests. // When connector shuts down, the request and response will not // be reused, so there is no issue to warn about here. - log.debug(message, e); + if (log.isDebugEnabled()) { + log.debug(sm.getString(messageKey), + new RecycleRequiredException()); + } } - // Log this request, as it has probably skipped the access log. - // The log() method will take care of recycling. - log(req, res, 0L); } } Modified: tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1595887&r1=1595886&r2=1595887&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Mon May 19 13:11:28 2014 @@ -17,7 +17,8 @@ cometEvent.nullRequest=The event object coyoteAdapter.accesslogFail=Exception while attempting to add an entry to the access log coyoteAdapter.asyncDispatch=Exception while processing an asynchronous request -coyoteAdapter.checkRecycled=A non-recycled request encountered. It will be recycled forcedly. +coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recycled it forcedly. +coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly. coyoteAdapter.debug=The variable [{0}] has value [{1}] coyoteAdapter.parsePathParam=Unable to parse the path parameters using encoding [{0}]. The path parameters in the URL will be ignored. Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1595887&r1=1595886&r2=1595887&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon May 19 13:11:28 2014 @@ -47,16 +47,20 @@ <section name="Tomcat 8.0.9 (markt)"> <subsection name="Catalina"> <changelog> - <add> - <bug>56526</bug>: Improved the <code>StuckThreadDetectionValve</code> to - optionally interrupt stuck threads to attempt to unblock them. - (slaurent) - </add> + <scode> + <bug>56399</bug>: Improve implementation of CoyoteAdapter.checkRecycled() + to do not use an exception for flow control. (kkolinko) + </scode> <add> <bug>56461</bug>: New <code>failCtxIfServletStartFails</code> attribute on Context and Host configuration to force the context startup to fail if a load-on-startup servlet fails its startup. (slaurent) </add> + <add> + <bug>56526</bug>: Improved the <code>StuckThreadDetectionValve</code> to + optionally interrupt stuck threads to attempt to unblock them. + (slaurent) + </add> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org