Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22237/src/java/org/logicalcobwebs/proxool
Modified Files:
ProxoolFacade.java ShutdownHook.java
Log Message:
Added ProxoolFacade.disableShutdownHook.
Index: ProxoolFacade.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxoolFacade.java,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** ProxoolFacade.java 18 Jan 2006 14:40:01 -0000 1.84
--- ProxoolFacade.java 2 Nov 2006 10:00:34 -0000 1.85
***************
*** 54,57 ****
--- 54,63 ----
/**
+ * If you setthis to false then it us up to you to call shutdown explicitly
+ * @see #shutdown(String, int)
+ */
+ private static boolean shutdownHookEnabled = true;
+
+ /**
* Build a ConnectionPool based on this definition and then start it.
* @param url defines the delegate driver and delegate url.
***************
*** 243,246 ****
--- 249,279 ----
/**
+ * If you call this then you'll have to call shutdown explicitly
+ * @see #shutdown(String, int)
+ */
+ public static void disableShutdownHook() {
+ ProxoolFacade.shutdownHookEnabled = false;
+ }
+
+ /**
+ * Call this if you change your mind about {@link #disableShutdownHook() disabling} it.
+ * The default behaviour is to have it enabled so unless you have disabled it then
+ * there's nothing to do.
+ */
+ public static void enableShutdownHook() {
+ ProxoolFacade.shutdownHookEnabled = true;
+ }
+
+ /**
+ * Whether the {@link ShutdownHook} should do anything.
+ * @see #disableShutdownHook()
+ * @see #enableShutdownHook()
+ * @return true if the shutdown hook should clean up
+ */
+ public static boolean isShutdownHookEnabled() {
+ return shutdownHookEnabled;
+ }
+
+ /**
* Like {@link #removeConnectionPool(java.lang.String, int)} but uses no delay. (Kills
* everything as quickly as possible).
***************
*** 822,825 ****
--- 855,861 ----
Revision history:
$Log$
+ Revision 1.85 2006/11/02 10:00:34 billhorsman
+ Added ProxoolFacade.disableShutdownHook.
+
Revision 1.84 2006/01/18 14:40:01 billhorsman
Unbundled Jakarta's Commons Logging.
Index: ShutdownHook.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ShutdownHook.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ShutdownHook.java 18 Jan 2006 14:40:02 -0000 1.12
--- ShutdownHook.java 2 Nov 2006 10:00:34 -0000 1.13
***************
*** 85,95 ****
/**
! * Remove all connection pools without delay
* @see ProxoolFacade#removeAllConnectionPools
*/
public void run() {
! LOG.debug("Running ShutdownHook");
! Thread.currentThread().setName("Shutdown Hook");
! ProxoolFacade.shutdown(0);
}
--- 85,100 ----
/**
! * Remove all connection pools without delay. Only runs if the
! * shutdown hook is {@link org.logicalcobwebs.proxool.ProxoolFacade#isShutdownHookEnabled() enabled}.
* @see ProxoolFacade#removeAllConnectionPools
*/
public void run() {
! if (ProxoolFacade.isShutdownHookEnabled()) {
! LOG.debug("Running ShutdownHook");
! Thread.currentThread().setName("Shutdown Hook");
! ProxoolFacade.shutdown(0);
! } else {
! LOG.debug("Skipping ShutdownHook because it's been disabled");
! }
}
***************
*** 100,103 ****
--- 105,111 ----
Revision history:
$Log$
+ Revision 1.13 2006/11/02 10:00:34 billhorsman
+ Added ProxoolFacade.disableShutdownHook.
+
Revision 1.12 2006/01/18 14:40:02 billhorsman
Unbundled Jakarta's Commons Logging.
|