db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r794303 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Date Wed, 15 Jul 2009 15:40:16 GMT
Author: mamta
Date: Wed Jul 15 15:40:16 2009
New Revision: 794303

URL: http://svn.apache.org/viewvc?rev=794303&view=rev
Log:
DERBY-4304
I have made changes to NetworkServerControlImpl.java so we handle the exceptions during different
steps of server shutdown and continue with the next step in shutdown rather than bailing out
after the first exception. 


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

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=794303&r1=794302&r2=794303&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Wed Jul 15 15:40:16 2009
@@ -804,26 +804,38 @@
             }
         }
         
-        AccessController.doPrivileged(
-                new PrivilegedAction() {
-                    public Object run()  {
-                    // Need to interrupt the memcheck thread if it is sleeping.
-                        if (mc != null)
-                            mc.interrupt();
-
-                        //interrupt client thread
-                        clientThread.interrupt();
-
-                        return null;
-                    }
-                });
+        try {
+            AccessController.doPrivileged(
+                    new PrivilegedAction() {
+                        public Object run()  {
+                        // Need to interrupt the memcheck thread if it is sleeping.
+                            if (mc != null)
+                                mc.interrupt();
+
+                            //interrupt client thread
+                            clientThread.interrupt();
+
+                            return null;
+                       }
+                    });
+        } catch (Exception exception) {
+            consolePropertyMessage("DRDA_UnexpectedException.S",			
+                exception.getMessage());
+            consoleExceptionPrintTrace(exception);
+        }
 		
  		// Close out the sessions
  		synchronized(sessionTable) {
  			for (Enumeration e = sessionTable.elements(); e.hasMoreElements(); )
  			{	
  				Session session = (Session) e.nextElement();
- 				session.close();
+ 				try {
+ 					session.close();
+ 				} catch (Exception exception) {
+ 					consolePropertyMessage("DRDA_UnexpectedException.S",			
+ 							exception.getMessage());
+ 					consoleExceptionPrintTrace(exception);
+ 				}
  			}
  		}
 
@@ -832,16 +844,22 @@
  			//interupt any connection threads still active
  			for (int i = 0; i < threadList.size(); i++)
  			{
-				final DRDAConnThread threadi = (DRDAConnThread)threadList.get(i);
-                
- 				threadi.close();
-				AccessController.doPrivileged(
-							new PrivilegedAction() {
-								public Object run() {
-									threadi.interrupt();
-									return null;
-								}
-							});
+ 				try {
+ 					final DRDAConnThread threadi = (DRDAConnThread)threadList.get(i);
+ 	                
+ 	 				threadi.close();
+ 					AccessController.doPrivileged(
+ 								new PrivilegedAction() {
+ 									public Object run() {
+ 										threadi.interrupt();
+ 										return null;
+ 									}
+ 								});
+ 				} catch (Exception exception) {
+ 					consolePropertyMessage("DRDA_UnexpectedException.S",			
+ 							exception.getMessage());
+ 					consoleExceptionPrintTrace(exception);
+ 				}
  			}
  			threadList.clear();
 		}
@@ -851,18 +869,33 @@
 	       serverSocket.close();
 	    }catch(IOException e){
 			consolePropertyMessage("DRDA_ListenerClose.S", true);
+	    } catch (Exception exception) {
+			consolePropertyMessage("DRDA_UnexpectedException.S",			
+					exception.getMessage());
+			consoleExceptionPrintTrace(exception);
 	    }
 
-
 		// Wake up those waiting on sessions, so
 		// they can close down
-		synchronized (runQueue) {
-			runQueue.notifyAll();
-		}	
+	    try{
+			synchronized (runQueue) {
+				runQueue.notifyAll();
+			}	
+	    } catch (Exception exception) {
+			consolePropertyMessage("DRDA_UnexpectedException.S",			
+					exception.getMessage());
+			consoleExceptionPrintTrace(exception);
+	    }
         
         // And now unregister any MBeans.
-        mgmtService.unregisterMBean(versionMBean);
-        mgmtService.unregisterMBean(networkServerMBean);
+	    try {
+	        mgmtService.unregisterMBean(versionMBean);
+	        mgmtService.unregisterMBean(networkServerMBean);
+	    } catch (Exception exception) {
+			consolePropertyMessage("DRDA_UnexpectedException.S",			
+					exception.getMessage());
+			consoleExceptionPrintTrace(exception);
+	    }
 
 		if (shutdownDatabasesOnShutdown) {
 
@@ -891,6 +924,10 @@
 					consolePropertyMessage("DRDA_ShutdownWarning.I",
 										   sqle.getMessage());
 				}
+			} catch (Exception exception) {
+				consolePropertyMessage("DRDA_UnexpectedException.S",			
+						exception.getMessage());
+				consoleExceptionPrintTrace(exception);
 			}
 		}
 



Mime
View raw message