[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool ShutdownHook.java,1.10,1.11
UNMAINTAINED!
Brought to you by:
billhorsman
|
From: <bil...@us...> - 2003-12-16 09:09:39
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool
In directory sc8-pr-cvs1:/tmp/cvs-serv15405/src/java/org/logicalcobwebs/proxool
Modified Files:
ShutdownHook.java
Log Message:
Switched from getCause() to getTargetException() so that we can trap the IllegalStateException in all JDKs.
Index: ShutdownHook.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ShutdownHook.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ShutdownHook.java 16 Nov 2003 18:19:14 -0000 1.10
--- ShutdownHook.java 16 Dec 2003 09:09:32 -0000 1.11
***************
*** 14,19 ****
/**
* This is instantiated statically by ProxoolFacade. It will automatically
! * close down all the connections when teh JVM stops.
! *
* @version $Revision$, $Date$
* @author bill
--- 14,18 ----
/**
* This is instantiated statically by ProxoolFacade. It will automatically
! * close down all the connections when the JVM stops.
* @version $Revision$, $Date$
* @author bill
***************
*** 49,64 ****
LOG.error("Problem removing shutdownHook", e);
} catch (InvocationTargetException e) {
! final Object o;
! try {
! final Method getCauseMethod = Runtime.class.getMethod("getCause", null);
! o = getCauseMethod.invoke(e, null);
! if (o != null && o instanceof IllegalStateException) {
! // This is probably because a shutdown is in progress. We can
! // safely ignore that.
! } else {
! LOG.error("Problem removing shutdownHook", e);
! }
! } catch (Exception ex) {
! LOG.error("Problem calling \"get cause\" on IllegalStateException.", e);
}
}
--- 48,58 ----
LOG.error("Problem removing shutdownHook", e);
} catch (InvocationTargetException e) {
! // Use getTargetException() because getCause() is only supported in JDK 1.4 and later
! Throwable cause = ((InvocationTargetException) e).getTargetException();
! if (cause instanceof IllegalStateException) {
! // This is probably because a shutdown is in progress. We can
! // safely ignore that.
! } else {
! LOG.error("Problem removing shutdownHook", e);
}
}
***************
*** 106,109 ****
--- 100,106 ----
Revision history:
$Log$
+ Revision 1.11 2003/12/16 09:09:32 billhorsman
+ Switched from getCause() to getTargetException() so that we can trap the IllegalStateException in all JDKs.
+
Revision 1.10 2003/11/16 18:19:14 chr32
Started calling to Exception.getCause() via refletion to maintain compilability with < jdk 1.4 compilers.
|