avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl AbstractServer.java ServerStreamReadWriter.java StreamServerConnection.java
Date Mon, 19 Aug 2002 03:06:07 GMT
leif        2002/08/18 20:06:07

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/server/impl
                        AbstractServer.java ServerStreamReadWriter.java
                        StreamServerConnection.java
  Log:
  Close any open client connections when the stream server is stopped.
  Leaving them open was causing problems when used in a Servlet within Tomcat.
  You would get ClassNotFoundExceptions as the connection threads were still
  running after Tomcat had destroyed the servlet.
  
  Revision  Changes    Path
  1.5       +7 -8      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java
  
  Index: AbstractServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractServer.java	24 Apr 2002 12:43:01 -0000	1.4
  +++ AbstractServer.java	19 Aug 2002 03:06:07 -0000	1.5
  @@ -176,14 +176,13 @@
   
       protected void killAllConnections()
       {
  -
  -        Iterator it = mConnections.iterator();
  -
  -        while( it.hasNext() )
  +        // Copy the connections into an array to avoid ConcurrentModificationExceptions
  +        //  as the connections are closed.
  +        AltrmiServerConnection[] connections =
  +            (AltrmiServerConnection[])mConnections.toArray( new AltrmiServerConnection[0]
);
  +        for ( int i = 0; i < connections.length; i++ )
           {
  -            AltrmiServerConnection asc = (AltrmiServerConnection)it.next();
  -
  -            asc.endConnection();
  +            connections[i].endConnection();
           }
       }
   
  
  
  
  1.4       +22 -1     jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java
  
  Index: ServerStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServerStreamReadWriter.java	24 Apr 2002 12:43:01 -0000	1.3
  +++ ServerStreamReadWriter.java	19 Aug 2002 03:06:07 -0000	1.4
  @@ -49,4 +49,25 @@
   
       protected abstract AltrmiRequest writeReplyAndGetRequest( AltrmiReply altrmiReply )
           throws IOException, ClassNotFoundException;
  +    
  +    protected void close()
  +    {
  +        try
  +        {
  +            mInputStream.close();
  +        }
  +        catch ( IOException e )
  +        {
  +            System.out.println( "Failed closing an Altrmi connection input stream: " +
e );
  +        }
  +        
  +        try
  +        {
  +            mOutputStream.close();
  +        }
  +        catch ( IOException e )
  +        {
  +            System.out.println( "Failed closing an Altrmi connection output stream: " +
e );
  +        }
  +    }
   }
  
  
  
  1.5       +2 -1      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/StreamServerConnection.java
  
  Index: StreamServerConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/StreamServerConnection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StreamServerConnection.java	24 Apr 2002 12:43:01 -0000	1.4
  +++ StreamServerConnection.java	19 Aug 2002 03:06:07 -0000	1.5
  @@ -145,6 +145,7 @@
       public void endConnection()
       {
           mEndConnection = true;
  +        mReadWriter.close();
       }
   
       /**
  
  
  

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