You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2009/08/31 15:49:27 UTC
svn commit: r809593 - in /db/derby/code/branches/10.4: ./
java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Author: mamta
Date: Mon Aug 31 13:49:26 2009
New Revision: 809593
URL: http://svn.apache.org/viewvc?rev=809593&view=rev
Log:
DERBY-4304
Merging revision 803548 from trunk into 10.4 codeline. Now all the work for DERBY-4304 has been backported to 10.4 codeline.
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 Mon Aug 31 13:49:26 2009
@@ -1 +1 @@
-/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,805696
+/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,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=809593&r1=809592&r2=809593&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 Mon Aug 31 13:49:26 2009
@@ -787,47 +787,48 @@
NetworkServerMBean.class,
"type=NetworkServer");
- // wait until we are told to shutdown or someone sends an InterruptedException
- synchronized(shutdownSync) {
- try {
- shutdownSync.wait();
- }
- catch (InterruptedException e)
- {
- shutdown = true;
- }
- }
-
- 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();
- try {
- session.close();
- } catch (Exception exception) {
- consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
- }
- }
- }
+ try {
+ // wait until we are told to shutdown or someone sends an InterruptedException
+ synchronized(shutdownSync) {
+ try {
+ shutdownSync.wait();
+ }
+ catch (InterruptedException e)
+ {
+ shutdown = true;
+ }
+ }
+
+ 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();
+ try {
+ session.close();
+ } catch (Exception exception) {
+ consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+ }
+ }
+ }
synchronized (threadList)
{
@@ -861,59 +862,69 @@
consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
}
- // Wake up those waiting on sessions, so
- // they can close down
- try{
- synchronized (runQueue) {
- runQueue.notifyAll();
- }
- } catch (Exception exception) {
- consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
- }
-
- // And now unregister any MBeans.
- try {
- mgmtService.unregisterMBean(versionMBean);
- mgmtService.unregisterMBean(networkServerMBean);
- } catch (Exception exception) {
- consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
- }
+ // Wake up those waiting on sessions, so
+ // they can close down
+ try{
+ synchronized (runQueue) {
+ runQueue.notifyAll();
+ }
+ } catch (Exception exception) {
+ consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+ }
+
+ // And now unregister any MBeans.
+ try {
+ mgmtService.unregisterMBean(versionMBean);
+ mgmtService.unregisterMBean(networkServerMBean);
+ } catch (Exception exception) {
+ consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
+ }
- if (shutdownDatabasesOnShutdown) {
+ if (shutdownDatabasesOnShutdown) {
- // Shutdown Derby
- try {
- // tell driver to shutdown the engine
- if (cloudscapeDriver != null) {
- // DERBY-2109: pass user credentials for driver shutdown
- final Properties p = new Properties();
- if (userArg != null) {
- p.setProperty("user", userArg);
+ // Shutdown Derby
+ try {
+ // tell driver to shutdown the engine
+ if (cloudscapeDriver != null) {
+ // DERBY-2109: pass user credentials for driver shutdown
+ final Properties p = new Properties();
+ if (userArg != null) {
+ p.setProperty("user", userArg);
+ }
+ if (passwordArg != null) {
+ p.setProperty("password", passwordArg);
+ }
+ cloudscapeDriver.connect("jdbc:derby:;shutdown=true", p);
}
- if (passwordArg != null) {
- p.setProperty("password", passwordArg);
+ } catch (SQLException sqle) {
+ // If we can't shutdown Derby, perhaps, authentication has
+ // failed or System Privileges weren't granted. We will just
+ // print a message to the console and proceed.
+ String expectedState =
+ StandardException.getSQLStateFromIdentifier(
+ SQLState.CLOUDSCAPE_SYSTEM_SHUTDOWN);
+ if (!expectedState.equals(sqle.getSQLState())) {
+ consolePropertyMessage("DRDA_ShutdownWarning.I",
+ sqle.getMessage());
}
- cloudscapeDriver.connect("jdbc:derby:;shutdown=true", p);
+ } catch (Exception exception) {
+ consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
}
- } catch (SQLException sqle) {
- // If we can't shutdown Derby, perhaps, authentication has
- // failed or System Privileges weren't granted. We will just
- // print a message to the console and proceed.
- String expectedState =
- StandardException.getSQLStateFromIdentifier(
- SQLState.CLOUDSCAPE_SYSTEM_SHUTDOWN);
- if (!expectedState.equals(sqle.getSQLState())) {
- consolePropertyMessage("DRDA_ShutdownWarning.I",
- sqle.getMessage());
- }
- } catch (Exception exception) {
- consolePrintAndIgnore("DRDA_UnexpectedException.S", exception, true);
}
- }
- consolePropertyMessage("DRDA_ShutdownSuccess.I", new String []
- {att_srvclsnm, versionString,
- getFormattedTimestamp()});
+ consolePropertyMessage("DRDA_ShutdownSuccess.I", new String []
+ {att_srvclsnm, versionString,
+getFormattedTimestamp()});
+
+ } catch (Exception ex) {
+ try {
+ //If the console printing is not available, then we have
+ //a simple stack trace print below to atleast print some
+ //exception info
+ consolePrintAndIgnore("DRDA_UnexpectedException.S", ex, true);
+ } catch (Exception e) {}
+ ex.printStackTrace();
+ }
}
//Print the passed exception on the console and ignore it after that