Update of /var/cvs/src/org/mmbase/cache
In directory james.mmbase.org:/tmp/cvs-serv3040

Modified Files:
        CacheManager.java 
Log Message:
better arranment to avoid that caches are registered without machine name


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/cache


Index: CacheManager.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/cache/CacheManager.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- CacheManager.java   23 Aug 2008 19:00:48 -0000      1.40
+++ CacheManager.java   5 Sep 2008 13:56:55 -0000       1.41
@@ -27,7 +27,7 @@
  * Cache manager manages the static methods of [EMAIL PROTECTED] Cache}. If 
you prefer you can call them on this in stead.
  *
  * @since MMBase-1.8
- * @version $Id: CacheManager.java,v 1.40 2008/08/23 19:00:48 michiel Exp $
+ * @version $Id: CacheManager.java,v 1.41 2008/09/05 13:56:55 michiel Exp $
  */
 public abstract class CacheManager {
 
@@ -96,14 +96,16 @@
      * @param cache A cache.
      * @return The previous cache of the same type (stored under the same name)
      */
-    public static <K,V> Cache<K,V> putCache(Cache<K,V> cache, boolean mbean) {
+    public static <K,V> Cache<K,V> putCache(final Cache<K,V> cache) {
         Cache old = caches.put(cache.getName(), cache);
         try {
             configure(configReader, cache.getName());
         } catch (Throwable t) {
             log.error(t.getMessage(), t);
         }
-        if (mbean) {
+        Runnable run = new Runnable() {
+                public void run() {
+                    
org.mmbase.bridge.ContextProvider.getDefaultCloudContext().assertUp();
             ObjectName name = getObjectName(cache);
             try {
                 MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
@@ -114,12 +116,17 @@
                 log.error("" + name + " " + t.getClass() + " " + 
t.getMessage());
             }
         }
-        return old;
+            };
+        if (org.mmbase.bridge.ContextProvider.getDefaultCloudContext().isUp()) 
{
+            run.run();
+        } else {
+            ThreadPools.jobsExecutor.execute(run);
     }
-    public static <K,V> Cache<K,V> putCache(Cache<K,V> cache) {
-        return putCache(cache, true);
+
+        return old;
     }
 
+
     /**
      * @since MMBase-1.9
      */
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to