db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r798742 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Date Wed, 29 Jul 2009 01:09:55 GMT
Author: mamta
Date: Wed Jul 29 01:09:55 2009
New Revision: 798742

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

During server shutdown substeps, catch any exception thrown, print it to console along with
stack trace and then move on to the next substep rather than re-throwing the exception after
console printing.


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=798742&r1=798741&r2=798742&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 29 01:09:55 2009
@@ -819,8 +819,7 @@
                        }
                     });
         } catch (Exception exception) {
-            consolePropertyMessage("DRDA_UnexpectedException.S", true);
-            consoleExceptionPrintTrace(exception);
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
         }
 		
  		// Close out the sessions
@@ -831,8 +830,7 @@
  				try {
  					session.close();
  				} catch (Exception exception) {
- 					consolePropertyMessage("DRDA_UnexpectedException.S", true);
- 					consoleExceptionPrintTrace(exception);
+ 		        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
  				}
  			}
  		}
@@ -854,8 +852,7 @@
  									}
  								});
  				} catch (Exception exception) {
- 					consolePropertyMessage("DRDA_UnexpectedException.S", true);
- 					consoleExceptionPrintTrace(exception);
+ 		        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
  				}
  			}
  			threadList.clear();
@@ -867,8 +864,7 @@
 	    }catch(IOException e){
 			consolePropertyMessage("DRDA_ListenerClose.S", true);
 	    } catch (Exception exception) {
-			consolePropertyMessage("DRDA_UnexpectedException.S", true);
-			consoleExceptionPrintTrace(exception);
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 	    }
 
 		// Wake up those waiting on sessions, so
@@ -878,8 +874,7 @@
 				runQueue.notifyAll();
 			}	
 	    } catch (Exception exception) {
-			consolePropertyMessage("DRDA_UnexpectedException.S", true);
-			consoleExceptionPrintTrace(exception);
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 	    }
         
         // And now unregister any MBeans.
@@ -887,8 +882,7 @@
 	        mgmtService.unregisterMBean(versionMBean);
 	        mgmtService.unregisterMBean(networkServerMBean);
 	    } catch (Exception exception) {
-			consolePropertyMessage("DRDA_UnexpectedException.S", true);
-			consoleExceptionPrintTrace(exception);
+        	consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 	    }
 
 		if (shutdownDatabasesOnShutdown) {
@@ -919,8 +913,7 @@
 										   sqle.getMessage());
 				}
 			} catch (Exception exception) {
-				consolePropertyMessage("DRDA_UnexpectedException.S", true);
-				consoleExceptionPrintTrace(exception);
+				consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
 			}
 		}
 
@@ -928,6 +921,17 @@
 						        {att_srvclsnm, versionString});
     }
 	
+	//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, true);
+		} 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