db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r809437 - in /db/derby/code/branches/10.4: ./ java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Date Sun, 30 Aug 2009 22:59:07 GMT
Author: mamta
Date: Sun Aug 30 22:59:07 2009
New Revision: 809437

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

Merged 5 out of 6 checkins that went in for DERBY-4304
svn merge -r 794302:794303 https://svn.apache.org/repos/asf/db/derby/code/trunk/
svn merge -r 796315:796316 https://svn.apache.org/repos/asf/db/derby/code/trunk/
svn merge -r 796371:796372 https://svn.apache.org/repos/asf/db/derby/code/trunk/
svn merge -r 798346:798347 https://svn.apache.org/repos/asf/db/derby/code/trunk/
svn merge -r 798741:798742 https://svn.apache.org/repos/asf/db/derby/code/trunk/

Will mege the last one as a separate checkin.


Modified:
    db/derby/code/branches/10.4/   (props changed)
    db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java

Propchange: db/derby/code/branches/10.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Aug 30 22:59:07 2009
@@ -1 +1 @@
-/db/derby/code/trunk:788436,793588,797147,800523,805696
+/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,805696

Modified: db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=809437&r1=809436&r2=809437&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Sun Aug 30 22:59:07 2009
@@ -798,26 +798,34 @@
             }
         }
         
-        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) {
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+        }
 		
  		// 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) {
+ 		        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+ 				}
  			}
  		}
 
@@ -826,16 +834,20 @@
  			//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) {
+ 		        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+ 				}
  			}
  			threadList.clear();
 		}
@@ -845,18 +857,27 @@
 	       serverSocket.close();
 	    }catch(IOException e){
 			consolePropertyMessage("DRDA_ListenerClose.S");
+	    } catch (Exception exception) {
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 	    }
 
-
 		// Wake up those waiting on sessions, so
 		// they can close down
-		synchronized (runQueue) {
-			runQueue.notifyAll();
-		}	
+	    try{
+			synchronized (runQueue) {
+				runQueue.notifyAll();
+			}	
+	    } catch (Exception exception) {
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+	    }
         
         // And now unregister any MBeans.
-        mgmtService.unregisterMBean(versionMBean);
-        mgmtService.unregisterMBean(networkServerMBean);
+	    try {
+	        mgmtService.unregisterMBean(versionMBean);
+	        mgmtService.unregisterMBean(networkServerMBean);
+	    } catch (Exception exception) {
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+	    }
 
 		if (shutdownDatabasesOnShutdown) {
 
@@ -885,6 +906,8 @@
 					consolePropertyMessage("DRDA_ShutdownWarning.I",
 										   sqle.getMessage());
 				}
+			} catch (Exception exception) {
+				consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 			}
 		}
 
@@ -893,6 +916,17 @@
 								getFormattedTimestamp()});
     }
 	
+	//Print the passed exception on the console and ignore it after that
+	private void consolePrintAndIgnore(String msgProp, 
+			Exception e, boolean printTimeStamp) {
+		// catch the exception consolePropertyMessage will throw since we
+		// just want to print information about it and move on.
+		try {
+			consolePropertyMessage(msgProp);
+		} catch (Exception ce) {} 
+		consoleExceptionPrintTrace(e);		
+	}
+	
 	/** 
 	 * Load Derby and save driver for future use.
 	 * We can't call Driver Manager when the client connects, 



Mime
View raw message