You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2014/04/11 14:13:16 UTC
svn commit: r1586621 -
/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java
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;
}