Author: markt Date: Fri Oct 7 11:51:39 2016 New Revision: 1763747 URL: http://svn.apache.org/viewvc?rev=1763747&view=rev Log: Reduce instances of logging, rethrowing and logging again when an exception occurs for a connector. One log message is sufficient.
Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/LocalStrings.properties Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1763747&r1=1763746&r2=1763747&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Fri Oct 7 11:51:39 2016 @@ -571,13 +571,7 @@ public abstract class AbstractProtocol<S String endpointName = getName(); endpoint.setName(endpointName.substring(1, endpointName.length()-1)); - try { - endpoint.init(); - } catch (Exception ex) { - getLog().error(sm.getString("abstractProtocolHandler.initError", - getName()), ex); - throw ex; - } + endpoint.init(); } @@ -586,13 +580,8 @@ public abstract class AbstractProtocol<S if (getLog().isInfoEnabled()) getLog().info(sm.getString("abstractProtocolHandler.start", getNameInternal())); - try { - endpoint.start(); - } catch (Exception ex) { - getLog().error(sm.getString("abstractProtocolHandler.startError", - getNameInternal()), ex); - throw ex; - } + + endpoint.start(); // Start async timeout thread asyncTimeout = new AsyncTimeout(); @@ -608,13 +597,8 @@ public abstract class AbstractProtocol<S if(getLog().isInfoEnabled()) getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); - try { - endpoint.pause(); - } catch (Exception ex) { - getLog().error(sm.getString("abstractProtocolHandler.pauseError", - getName()), ex); - throw ex; - } + + endpoint.pause(); } @Override @@ -622,13 +606,8 @@ public abstract class AbstractProtocol<S if(getLog().isInfoEnabled()) getLog().info(sm.getString("abstractProtocolHandler.resume", getName())); - try { - endpoint.resume(); - } catch (Exception ex) { - getLog().error(sm.getString("abstractProtocolHandler.resumeError", - getName()), ex); - throw ex; - } + + endpoint.resume(); } @@ -642,49 +621,40 @@ public abstract class AbstractProtocol<S asyncTimeout.stop(); } - try { - endpoint.stop(); - } catch (Exception ex) { - getLog().error(sm.getString("abstractProtocolHandler.stopError", - getName()), ex); - throw ex; - } + endpoint.stop(); } @Override - public void destroy() { + public void destroy() throws Exception { if(getLog().isInfoEnabled()) { getLog().info(sm.getString("abstractProtocolHandler.destroy", getName())); } try { endpoint.destroy(); - } catch (Exception e) { - getLog().error(sm.getString("abstractProtocolHandler.destroyError", - getName()), e); - } - - if (oname != null) { - if (mserver == null) { - Registry.getRegistry(null, null).unregisterComponent(oname); - } else { - // Possibly registered with a different MBeanServer - try { - mserver.unregisterMBean(oname); - } catch (MBeanRegistrationException | - InstanceNotFoundException e) { - getLog().info(sm.getString( - "abstractProtocol.mbeanDeregistrationFailed", - oname, mserver)); + } finally { + if (oname != null) { + if (mserver == null) { + Registry.getRegistry(null, null).unregisterComponent(oname); + } else { + // Possibly registered with a different MBeanServer + try { + mserver.unregisterMBean(oname); + } catch (MBeanRegistrationException | + InstanceNotFoundException e) { + getLog().info(sm.getString( + "abstractProtocol.mbeanDeregistrationFailed", + oname, mserver)); + } } } - } - if (tpOname != null) - Registry.getRegistry(null, null).unregisterComponent(tpOname); - if (rgOname != null) - Registry.getRegistry(null, null).unregisterComponent(rgOname); + if (tpOname != null) + Registry.getRegistry(null, null).unregisterComponent(tpOname); + if (rgOname != null) + Registry.getRegistry(null, null).unregisterComponent(rgOname); + } } Modified: tomcat/trunk/java/org/apache/coyote/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/LocalStrings.properties?rev=1763747&r1=1763746&r2=1763747&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/coyote/LocalStrings.properties Fri Oct 7 11:51:39 2016 @@ -29,18 +29,12 @@ abstractProtocol.mbeanDeregistrationFail abstractProtocolHandler.getAttribute=Get attribute [{0}] with value [{1}] abstractProtocolHandler.setAttribute=Set attribute [{0}] with value [{1}] abstractProtocolHandler.init=Initializing ProtocolHandler [{0}] -abstractProtocolHandler.initError=Failed to initialize end point associated with ProtocolHandler [{0}] abstractProtocolHandler.mbeanRegistrationFailed=Failed to register MBean [{0}] for ProtocolHandler [{1}] abstractProtocolHandler.start=Starting ProtocolHandler [{0}] -abstractProtocolHandler.startError=Failed to start end point associated with ProtocolHandler [{0}] abstractProtocolHandler.pause=Pausing ProtocolHandler [{0}] -abstractProtocolHandler.pauseError=Failed to pause end point associated with ProtocolHandler [{0}] abstractProtocolHandler.resume=Resuming ProtocolHandler [{0}] -abstractProtocolHandler.resumeError=Failed to resume end point associated with ProtocolHandler [{0}] abstractProtocolHandler.stop=Stopping ProtocolHandler [{0}] -abstractProtocolHandler.stopError=Failed to stop end point associated with ProtocolHandler [{0}] abstractProtocolHandler.destroy=Destroying ProtocolHandler [{0}] -abstractProtocolHandler.destroyError=Failed to destroy end point associated with ProtocolHandler [{0}] asyncStateMachine.invalidAsyncState=Calling [{0}] is not valid for a request with Async state [{1}] --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org