[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool ShutdownHook.java,1.9,1.10
UNMAINTAINED!
Brought to you by:
billhorsman
From: <ch...@us...> - 2003-11-16 18:20:11
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1:/tmp/cvs-serv4561 Modified Files: ShutdownHook.java Log Message: Started calling to Exception.getCause() via refletion to maintain compilability with < jdk 1.4 compilers. Index: ShutdownHook.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ShutdownHook.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ShutdownHook.java 27 Oct 2003 12:32:06 -0000 1.9 --- ShutdownHook.java 16 Nov 2003 18:19:14 -0000 1.10 *************** *** 37,42 **** Runtime runtime = Runtime.getRuntime(); try { ! Method addShutdownHookMethod = Runtime.class.getMethod("removeShutdownHook", new Class[] {Thread.class}); ! addShutdownHookMethod.invoke(runtime, new Object[] {t}); if (LOG.isDebugEnabled()) { LOG.debug("Removed shutdownHook"); --- 37,42 ---- Runtime runtime = Runtime.getRuntime(); try { ! final Method removeShutdownHookMethod = Runtime.class.getMethod("removeShutdownHook", new Class[] {Thread.class}); ! removeShutdownHookMethod.invoke(runtime, new Object[] {t}); if (LOG.isDebugEnabled()) { LOG.debug("Removed shutdownHook"); *************** *** 49,57 **** LOG.error("Problem removing shutdownHook", e); } catch (InvocationTargetException e) { ! if (e.getCause() instanceof IllegalStateException) { ! // This is probably because a shutdown is in progress. We can ! // safely ignore that. ! } else { ! LOG.error("Problem removing shutdownHook", e); } } --- 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); } } *************** *** 99,102 **** --- 106,112 ---- Revision history: $Log$ + 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. + Revision 1.9 2003/10/27 12:32:06 billhorsman Fixed typos and silently ignore IllegalStateException during shutdownHook removal (it's probably because |