[infinispan-commits] Infinispan SVN: r2488 - branches/4.2.x/core/src/main/java/org/infinispan/manager.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Oct 4 13:54:24 EDT 2010


Author: vblagojevic at jboss.com
Date: 2010-10-04 13:54:24 -0400 (Mon, 04 Oct 2010)
New Revision: 2488

Modified:
   branches/4.2.x/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java
Log:
release lock on CacheWrapper latch in finally clause

Modified: branches/4.2.x/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java	2010-10-04 17:20:04 UTC (rev 2487)
+++ branches/4.2.x/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java	2010-10-04 17:54:24 UTC (rev 2488)
@@ -485,13 +485,15 @@
       c.assertValid();
       Cache cache = new InternalCacheFactory().createCache(c, globalComponentRegistry, cacheName);
       CacheWrapper cw = new CacheWrapper(cache);
-      existingCache = caches.putIfAbsent(cacheName, cw);
-      if (existingCache != null) {
-         throw new IllegalStateException("attempt to initialize the cache twice");
+      try {
+         existingCache = caches.putIfAbsent(cacheName, cw);
+         if (existingCache != null) {
+            throw new IllegalStateException("attempt to initialize the cache twice");
+         }
+         cache.start();
+      } finally {
+         cw.latch.countDown();
       }
-
-      cache.start();
-      cw.latch.countDown();
       return cache;
    }
 



More information about the infinispan-commits mailing list