avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/connection Connection.java
Date Sat, 22 Dec 2001 10:46:31 GMT
hammant     01/12/22 02:46:31

  Modified:    src/java/org/apache/avalon/cornerstone/services/connection
                        ConnectionHandlerFactory.java
                        DefaultHandlerFactory.java
               src/java/org/apache/avalon/cornerstone/blocks/connection
                        Connection.java
  Log:
  release method added. From Jan <vincev@gmx.de>
  
  Revision  Changes    Path
  1.4       +6 -0      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/connection/ConnectionHandlerFactory.java
  
  Index: ConnectionHandlerFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/connection/ConnectionHandlerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConnectionHandlerFactory.java	2001/12/11 10:49:20	1.3
  +++ ConnectionHandlerFactory.java	2001/12/22 10:46:31	1.4
  @@ -22,5 +22,11 @@
        */
       ConnectionHandler createConnectionHandler()
           throws Exception;
  +
  +    /**
  +     * Release a previously created ConnectionHandler e.g. for spooling.
  +     */
  +    void releaseConnectionHandler( ConnectionHandler connectionHandler );
  +
   }
   
  
  
  
  1.4       +7 -0      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/connection/DefaultHandlerFactory.java
  
  Index: DefaultHandlerFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/connection/DefaultHandlerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultHandlerFactory.java	2001/12/11 10:49:20	1.3
  +++ DefaultHandlerFactory.java	2001/12/22 10:46:31	1.4
  @@ -33,4 +33,11 @@
       {
           return (ConnectionHandler)m_handlerClass.newInstance();
       }
  +
  +    /**
  +     * Release a previously created ConnectionHandler e.g. for spooling.
  +     */
  +    public void releaseConnectionHandler(ConnectionHandler connectionHandler)
  +    {
  +    }
   }
  
  
  
  1.8       +13 -8     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Connection.java	2001/12/11 10:49:19	1.7
  +++ Connection.java	2001/12/22 10:46:31	1.8
  @@ -59,7 +59,7 @@
                   m_thread = null;
                   thread.interrupt();
   
  -                //Can not join as threads are part of pool 
  +                //Can not join as threads are part of pool
                   //and will never finish
                   //m_thread.join();
                   
  @@ -93,7 +93,7 @@
                   final Socket socket = m_serverSocket.accept();
                   final ConnectionHandler handler = m_handlerFactory.createConnectionHandler();
                   final ConnectionRunner runner =
  -                    new ConnectionRunner( socket, m_runners, handler );
  +                    new ConnectionRunner( socket, m_runners, handler, m_handlerFactory
);
                   setupLogger( runner );
                   m_threadPool.execute( runner );
               }
  @@ -123,18 +123,21 @@
       extends AbstractLogEnabled
       implements Runnable, Component
   {
  -    private Socket             m_socket;
  -    private Thread             m_thread;
  -    private List               m_runners;
  -    private ConnectionHandler  m_handler;
  +    private Socket                    m_socket;
  +    private Thread                    m_thread;
  +    private List                      m_runners;
  +    private ConnectionHandler         m_handler;
  +    private ConnectionHandlerFactory  m_handlerFactory;
   
       ConnectionRunner( final Socket socket,
                         final List runners,
  -                      final ConnectionHandler handler )
  +                      final ConnectionHandler handler,
  +                      final ConnectionHandlerFactory handlerFactory )
       {
           m_socket = socket;
           m_runners = runners;
           m_handler = handler;
  +        m_handlerFactory = handlerFactory;
       }
   
       public void dispose()
  @@ -144,12 +147,13 @@
           {
               m_thread.interrupt();
               m_thread = null;
  -            //Can not join as threads are part of pool 
  +            //Can not join as threads are part of pool
               //and will never finish
               //m_thread.join();
   
               synchronized( this ) { wait( /*1000*/ ); }
           }
  +        m_handlerFactory = null;
       }
   
       public void run()
  @@ -162,6 +166,7 @@
               getLogger().debug( "Starting connection on " + m_socket );
               m_handler.handleConnection( m_socket );
               getLogger().debug( "Ending connection on " + m_socket );
  +            m_handlerFactory.releaseConnectionHandler(m_handler);
           }
           catch( final Exception e )
           {
  
  
  

--
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