avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/server CMDConnectionHandler.java
Date Tue, 13 Nov 2001 14:49:40 GMT
hammant     01/11/13 06:49:40

  Modified:    apps/db/src/java/org/apache/avalon/db/driver
                        AvalonDBConnection.java
               apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client
                        CommandConnection.java
               apps/db/src/java/org/apache/avalon/db/transport/cmdstream/server
                        CMDConnectionHandler.java
  Log:
  Correct closing of connection
  
  Revision  Changes    Path
  1.6       +2 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBConnection.java
  
  Index: AvalonDBConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBConnection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AvalonDBConnection.java	2001/11/04 10:22:13	1.5
  +++ AvalonDBConnection.java	2001/11/13 14:49:40	1.6
  @@ -42,7 +42,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class AvalonDBConnection extends AbstractDriver implements Connection {
   
  @@ -244,6 +244,7 @@
       public void close() throws SQLException {
           Reply reply = sendRequest(new CloseRequest());
           handleSQLException(reply);
  +        closeConnection();
           closed = true;
       }
   
  
  
  
  1.8       +2 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client/CommandConnection.java
  
  Index: CommandConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client/CommandConnection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CommandConnection.java	2001/11/04 10:22:13	1.7
  +++ CommandConnection.java	2001/11/13 14:49:40	1.8
  @@ -32,7 +32,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class CommandConnection extends AvalonDBConnection {
   
  @@ -65,7 +65,7 @@
               mObjectInputStream.close();
               mObjectOutputStream.close();
           } catch (IOException ioe) {
  -            throw new SQLException("Unable to close ObjectStrams used by Driver");
  +            throw new SQLException("Unable to close ObjectStreams used by Driver");
           } finally {
               mObjectInputStream = null;
               mObjectOutputStream = null;
  
  
  
  1.3       +16 -4     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/server/CMDConnectionHandler.java
  
  Index: CMDConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/server/CMDConnectionHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CMDConnectionHandler.java	2001/11/10 21:45:04	1.2
  +++ CMDConnectionHandler.java	2001/11/13 14:49:40	1.3
  @@ -21,6 +21,7 @@
   import java.io.IOException;
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
  +import java.io.EOFException;
   
   import java.net.Socket;
   
  @@ -63,16 +64,27 @@
           mObjectOutputStream = new ObjectOutputStream(socket.getOutputStream());
           mObjectInputStream = new ObjectInputStream(socket.getInputStream());
   
  -        getLogger().debug("AvalonDBConnection from " + remoteHost + " (" + remoteIP + ")");
  +        getLogger().debug("AvalonDBConnection:Open from " + remoteHost + " (" + remoteIP
+ ")");
   
  -        while (true) {
  +        boolean more = true;
  +        while (more) {
               Request request = null;
   
               try {
                   request = (Request) mObjectInputStream.readObject();
  -            } catch (ClassNotFoundException cnfe) {}    // won't happen.
  +            } catch (ClassNotFoundException cnfe) {    // won't happen.
  +            } catch (EOFException eofe) {
  +                more = false;
  +            }
  +            if (more) {
  +               mObjectOutputStream.writeObject(mDatabaseManager.processRequest(request));
  +            }
  +
  +            if (request.getRequestCode() == Request.CLOSE) {
  +                more = false;
  +            }
   
  -            mObjectOutputStream.writeObject(mDatabaseManager.processRequest(request));
           }
  +        getLogger().debug("AvalonDBConnection:Close from " + remoteHost + " (" + remoteIP
+ ")");
       }
   }
  
  
  

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


Mime
View raw message