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

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Oct 21 08:21:13 EDT 2010


Author: manik.surtani at jboss.com
Date: 2010-10-21 08:21:13 -0400 (Thu, 21 Oct 2010)
New Revision: 2537

Modified:
   branches/4.2.x/core/src/main/java/org/infinispan/AbstractDelegatingAdvancedCache.java
   branches/4.2.x/core/src/main/java/org/infinispan/AdvancedCache.java
   branches/4.2.x/core/src/main/java/org/infinispan/CacheDelegate.java
Log:
Varargs for lock API params

Modified: branches/4.2.x/core/src/main/java/org/infinispan/AbstractDelegatingAdvancedCache.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/AbstractDelegatingAdvancedCache.java	2010-10-21 12:20:36 UTC (rev 2536)
+++ branches/4.2.x/core/src/main/java/org/infinispan/AbstractDelegatingAdvancedCache.java	2010-10-21 12:21:13 UTC (rev 2537)
@@ -90,7 +90,7 @@
       return this;
    }
 
-   public boolean lock(K key) {
+   public boolean lock(K... key) {
       return cache.lock(key);
    }
 

Modified: branches/4.2.x/core/src/main/java/org/infinispan/AdvancedCache.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/AdvancedCache.java	2010-10-21 12:20:36 UTC (rev 2536)
+++ branches/4.2.x/core/src/main/java/org/infinispan/AdvancedCache.java	2010-10-21 12:21:13 UTC (rev 2537)
@@ -101,16 +101,15 @@
     */
    DistributionManager getDistributionManager();
 
-
    /**
-    * Locks a given key eagerly across cache nodes in a cluster.
+    * Locks a given key or keys eagerly across cache nodes in a cluster.
     * <p>
-    * A key can be locked eagerly in the context of a transaction only
+    * Keys can be locked eagerly in the context of a transaction only
     *
-    * @param key the key to lock
-    * @return true if the lock acquisition attempt was successful; false otherwise.
-    */
-   boolean lock(K key);
+    * @param keys the keys to lock
+    * @return true if the lock acquisition attempt was successful for <i>all</i> keys; false otherwise.
+    */   
+   boolean lock(K... keys);
 
    /**
     * Locks collections of keys eagerly across cache nodes in a cluster.

Modified: branches/4.2.x/core/src/main/java/org/infinispan/CacheDelegate.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/CacheDelegate.java	2010-10-21 12:20:36 UTC (rev 2536)
+++ branches/4.2.x/core/src/main/java/org/infinispan/CacheDelegate.java	2010-10-21 12:21:13 UTC (rev 2537)
@@ -285,9 +285,9 @@
       return ctx;
    }
 
-   public boolean lock(K key) {
-      assertKeyNotNull(key);
-      return lock(Collections.singletonList(key));
+   public boolean lock(K... keys) {
+      assertKeyNotNull(keys);
+      return lock(Arrays.asList(keys));
    }
 
    public boolean lock(Collection<? extends K> keys) {



More information about the infinispan-commits mailing list