db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r823659 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java
Date Fri, 09 Oct 2009 18:44:12 GMT
Author: mamta
Date: Fri Oct  9 18:44:11 2009
New Revision: 823659

URL: http://svn.apache.org/viewvc?rev=823659&view=rev
Log:
DERBY-4326

Rather than quiting out of ClientThread for InterruptedException and IOException, we should
first check if the exceptions aree raised because of server being shutdown. If yes, then we
should quit out of ClientThread. Otherwise, we should log the exception and close the client
socket that got the exception and go back to the infinite loop waiting for next client connection.


Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java?rev=823659&r1=823658&r2=823659&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ClientThread.java Fri Oct  9
18:44:11 2009
@@ -92,13 +92,19 @@
                     } // end inner try/catch block
                     
                 } catch (InterruptedException ie) {
-                    // This is a shutdown and we'll just exit the
-                    // thread. NOTE: This is according to the logic
-                    // before this rewrite. I am not convinced that it
-                    // is allways the case, but will not alter the
-                    // behaviour since it is not within the scope of
-                    // this change (DERBY-2108).
-                    return;
+                    if (parent.getShutdown()) {
+                        // This is a shutdown and we'll just exit the
+                        // thread. NOTE: This is according to the logic
+                        // before this rewrite. I am not convinced that it
+                        // is allways the case, but will not alter the
+                        // behaviour since it is not within the scope of
+                        // this change (DERBY-2108).
+                    	clientSocket.close();
+            	        return;
+                    }
+                    parent.consoleExceptionPrintTrace(ie);
+                    if (clientSocket != null)
+                        clientSocket.close();
 
                 } catch (javax.net.ssl.SSLException ssle) {
                     // SSLException is a subclass of
@@ -115,17 +121,17 @@
                     return; // Exit the thread
                     
                 } catch (IOException ioe) {
+                    if (clientSocket != null)
+                        clientSocket.close();
                     // IOException causes this thread to stop.  No
                     // console error message if this was caused by a
                     // shutdown
                     synchronized (parent.getShutdownSync()) {
-                        if (!parent.getShutdown()) {
-                            parent.consoleExceptionPrintTrace(ioe);
-                            if (clientSocket != null)
-                                clientSocket.close();
-                        }
+                        if (parent.getShutdown()) {
+                            return; // Exit the thread
+                        } 
                     }
-                    return; // Exit the thread
+                    parent.consoleExceptionPrintTrace(ioe);
                 }
             } catch (Exception e) {
                 // Catch and log all other exceptions



Mime
View raw message