donaldp 2002/07/11 18:21:33 Modified: src/java/org/apache/avalon/cornerstone/blocks/connection Connection.java Log: Add shutdownSocket() to simplify code. Extracted messages to their own variables Revision Changes Path 1.14 +23 -11 jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/connection/Connection.java Index: Connection.java =================================================================== RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/connection/Connection.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Connection.java 12 Jul 2002 00:34:52 -0000 1.13 +++ Connection.java 12 Jul 2002 01:21:33 -0000 1.14 @@ -101,11 +101,13 @@ } catch( final IOException ioe ) { - getLogger().error( "Exception accepting connection", ioe ); + final String message = "Exception accepting connection"; + getLogger().error( message, ioe ); } catch( final Exception e ) { - getLogger().error( "Exception executing runner", e ); + final String message = "Exception executing runner"; + getLogger().error( message, e ); } } @@ -183,7 +185,8 @@ } catch( final Exception e ) { - getLogger().warn( "Error handling connection", e ); + final String message = "Error handling connection"; + getLogger().warn( message, e ); } finally { @@ -192,14 +195,7 @@ m_handlerFactory.releaseConnectionHandler( handler ); } - try - { - m_socket.close(); - } - catch( final IOException ioe ) - { - getLogger().warn( "Error shutting down connection", ioe ); - } + shutdownSocket(); synchronized( this ) { @@ -208,6 +204,22 @@ notifyAll(); } + } + } + + /** + * Utility method for shutting down associated socket. + */ + private void shutdownSocket() + { + try + { + m_socket.close(); + } + catch( final IOException ioe ) + { + final String message = "Error shutting down connection"; + getLogger().warn( message, ioe ); } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>