commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1586621 - /commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
Date Fri, 11 Apr 2014 12:13:16 GMT
Author: tv
Date: Fri Apr 11 12:13:16 2014
New Revision: 1586621

URL: http://svn.apache.org/r1586621
Log:
Clean up lifecycle

Modified:
    commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java?rev=1586621&r1=1586620&r2=1586621&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
(original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
Fri Apr 11 12:13:16 2014
@@ -167,6 +167,11 @@ public class CompositeCacheManager
             instance = createInstance();
         }
 
+        if (!instance.isInitialized())
+        {
+            instance.initialize();
+        }
+
         if (!instance.isConfigured())
         {
             instance.configure( propsFilename );
@@ -195,6 +200,11 @@ public class CompositeCacheManager
             instance = createInstance();
         }
 
+        if (!instance.isInitialized())
+        {
+            instance.initialize();
+        }
+
         instance.incrementClients();
 
         return instance;
@@ -216,7 +226,7 @@ public class CompositeCacheManager
      */
     protected CompositeCacheManager()
     {
-        initialize();
+    	// empty
     }
 
     /** Creates a shutdown hook and starts the scheduler service */
@@ -631,8 +641,6 @@ public class CompositeCacheManager
     {
         synchronized (CompositeCacheManager.class)
         {
-            isInitialized = false;
-
             // shutdown all scheduled jobs
             this.scheduledExecutor.shutdownNow();
 
@@ -671,7 +679,22 @@ public class CompositeCacheManager
                 freeCache( name );
             }
 
+            if (shutdownHook != null)
+            {
+            	try
+            	{
+					Runtime.getRuntime().removeShutdownHook(shutdownHook);
+				}
+            	catch (IllegalStateException e)
+            	{
+					// May fail if the JVM is already shutting down
+				}
+
+            	this.shutdownHook = null;
+            }
+
             isConfigured = false;
+            isInitialized = false;
         }
     }
 
@@ -882,7 +905,7 @@ public class CompositeCacheManager
      * <p>
      * @param props
      */
-    public void setConfigurationProperties( Properties props )
+    void setConfigurationProperties( Properties props )
     {
         this.configurationProperties = props;
     }



Mime
View raw message