avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy Resources.properties AbstractHttpProxyServer.java
Date Tue, 03 Sep 2002 06:52:36 GMT
colus       2002/09/02 23:52:36

  Modified:    httpproxy/src/java/org/apache/avalon/httpproxy
                        Resources.properties AbstractHttpProxyServer.java
  Log:
  Close server socket when dispose.
  
  Revision  Changes    Path
  1.4       +1 -0      jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/Resources.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Resources.properties	1 May 2002 02:36:02 -0000	1.3
  +++ Resources.properties	3 Sep 2002 06:52:36 -0000	1.4
  @@ -1,5 +1,6 @@
   server.notice.ready={0} HTTP Proxy server running. Configure your browser to proxy through
localhost:{1,number,integer} to use it.
   server.error.disconnect=Error disconnecting.
  +server.error.close=Error closing server socket.
   handler.notice.timeout=Connection to {0} timeout.
   handler.notice.closed-remotely=Connection to {0} closed remotely.
   handler.error.open=Exception in proxy opening socket to {0}.
  
  
  
  1.9       +15 -9     jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java
  
  Index: AbstractHttpProxyServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractHttpProxyServer.java	18 May 2002 09:49:01 -0000	1.8
  +++ AbstractHttpProxyServer.java	3 Sep 2002 06:52:36 -0000	1.9
  @@ -7,6 +7,7 @@
    */
   package org.apache.avalon.httpproxy;
   
  +import java.io.IOException;
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.UnknownHostException;
  @@ -36,7 +37,7 @@
    */
   public abstract class AbstractHttpProxyServer
       extends AbstractLogEnabled
  -    implements Contextualizable, Serviceable, Configurable,
  +    implements Serviceable, Configurable,
       Initializable, Disposable, ConnectionHandlerFactory
   {
       private static final Resources REZ =
  @@ -50,18 +51,13 @@
       protected String m_forwardToAnotherProxy;
       protected int m_port;
       protected InetAddress m_bindTo;
  -    protected BlockContext m_context;
  +    protected ServerSocket m_serverSocket;
   
       public AbstractHttpProxyServer( final String name )
       {
           m_name = name;
       }
   
  -    public void contextualize( final Context context )
  -    {
  -        m_context = (BlockContext)context;
  -    }
  -
       public void configure( final Configuration configuration )
           throws ConfigurationException
       {
  @@ -93,10 +89,10 @@
       {
           final ServerSocketFactory factory =
               m_socketManager.getServerSocketFactory( "plain" );
  -        final ServerSocket serverSocket = factory.createServerSocket( m_port, 5, m_bindTo
);
  +        m_serverSocket = factory.createServerSocket( m_port, 5, m_bindTo );
   
           m_connectionName = "HttpProxyListener-" + m_name;
  -        m_connectionManager.connect( m_connectionName, serverSocket, this );
  +        m_connectionManager.connect( m_connectionName, m_serverSocket, this );
   
           // This is only to help newbies.....
           if ( getLogger().isInfoEnabled() )
  @@ -116,6 +112,16 @@
           {
               final String message = REZ.getString( "server.error.disconnect" );
               getLogger().warn( message, e );
  +        }
  +
  +        try
  +        {
  +            m_serverSocket.close();
  +        }
  +        catch( final IOException ioe )
  +        {
  +            final String message = REZ.getString( "server.error.close" );
  +            getLogger().warn( message, ioe );
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message