geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bogle...@apache.org
Subject incubator-geode git commit: GEODE-825: A client with subscriptions enabled receives an additional event when invoking get with a CacheLoader
Date Fri, 22 Jan 2016 21:32:39 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop b370a703c -> ae1ab717c


GEODE-825: A client with subscriptions enabled receives an additional event when invoking
get with a CacheLoader


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ae1ab717
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ae1ab717
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ae1ab717

Branch: refs/heads/develop
Commit: ae1ab717c8db203648ede69efaaa00a52c87deed
Parents: b370a70
Author: Barry Oglesby <boglesby@pivotal.io>
Authored: Thu Jan 21 11:18:11 2016 -0800
Committer: Barry Oglesby <boglesby@pivotal.io>
Committed: Fri Jan 22 13:17:13 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/cache/BucketRegion.java    |   5 +-
 .../gemfire/internal/cache/LocalRegion.java     |   4 +-
 .../internal/cache/LocalRegionDataView.java     |   2 +-
 .../cache/PartitionedRegionDataStore.java       |   4 +-
 .../cache/PartitionedRegionDataView.java        |   2 +-
 .../gemfire/internal/cache/TXState.java         |   2 +-
 .../gemfire/cache30/Bug38741DUnitTest.java      |   2 +-
 .../tier/sockets/InterestListDUnitTest.java     | 201 ++++++++++++++++++-
 8 files changed, 211 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java
index f487bd5..fae381f 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java
@@ -83,6 +83,7 @@ import com.gemstone.gemfire.internal.cache.partitioned.PutAllPRMessage;
 import com.gemstone.gemfire.internal.cache.partitioned.PutMessage;
 import com.gemstone.gemfire.internal.cache.partitioned.RemoveAllPRMessage;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ClientTombstoneMessage;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage;
 import com.gemstone.gemfire.internal.cache.versions.VersionSource;
@@ -1490,7 +1491,7 @@ implements Bucket
    * @throws IOException if the result is not serializable
    * @see LocalRegion#get(Object, Object, boolean, EntryEventImpl)
    */
-  public RawValue getSerialized(KeyInfo keyInfo, boolean generateCallbacks, boolean doNotLockEntry,
EntryEventImpl clientEvent, boolean returnTombstones, boolean allowReadFromHDFS) throws IOException
{
+  public RawValue getSerialized(KeyInfo keyInfo, boolean generateCallbacks, boolean doNotLockEntry,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones,
boolean allowReadFromHDFS) throws IOException {
     checkReadiness();
     checkForNoAccess();
     CachePerfStats stats = getCachePerfStats();
@@ -1513,7 +1514,7 @@ implements Bucket
           }
           // TODO OFFHEAP: optimze
           Object value = nonTxnFindObject(keyInfo, isCreate,
-              generateCallbacks, result.getRawValue(), true, true, clientEvent, false, allowReadFromHDFS);
+              generateCallbacks, result.getRawValue(), true, true, requestingClient, clientEvent,
false, allowReadFromHDFS);
           if (value != null) {
             result = new RawValue(value);
           }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
index 2d9f720..49359cb 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
@@ -1552,7 +1552,7 @@ public class LocalRegion extends AbstractRegion
   @Retained
   Object nonTxnFindObject(KeyInfo keyInfo, boolean p_isCreate,
       boolean generateCallbacks, Object p_localValue, boolean disableCopyOnRead, boolean
preferCD,
-      EntryEventImpl clientEvent, boolean returnTombstones, boolean allowReadFromHDFS) 
+      ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones,
boolean allowReadFromHDFS) 
       throws TimeoutException, CacheLoaderException
   {
     final Object key = keyInfo.getKey();
@@ -1627,7 +1627,7 @@ public class LocalRegion extends AbstractRegion
         }
         isCreate = localValue == null;
         result = findObjectInSystem(keyInfo, isCreate, null, generateCallbacks,
-            localValue, disableCopyOnRead, preferCD, null, clientEvent, returnTombstones,
false/*allowReadFromHDFS*/);
+            localValue, disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones,
false/*allowReadFromHDFS*/);
 
       } else {
         

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegionDataView.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegionDataView.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegionDataView.java
index b80874c..dddb64e 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegionDataView.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegionDataView.java
@@ -139,7 +139,7 @@ public class LocalRegionDataView implements InternalDataView {
    */
   public Object findObject(KeyInfo keyInfo, LocalRegion r, boolean isCreate,
       boolean generateCallbacks, Object value, boolean disableCopyOnRead, boolean preferCD,
ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones,
boolean allowReadFromHDFS) {
-   return r.nonTxnFindObject(keyInfo, isCreate, generateCallbacks, value, disableCopyOnRead,
preferCD, clientEvent, returnTombstones, allowReadFromHDFS);
+   return r.nonTxnFindObject(keyInfo, isCreate, generateCallbacks, value, disableCopyOnRead,
preferCD, requestingClient, clientEvent, returnTombstones, allowReadFromHDFS);
   }
 
   /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java
index a4480f9..5f28c93 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java
@@ -2114,7 +2114,7 @@ public class PartitionedRegionDataStore implements HasCachePerfStats
    * @throws PrimaryBucketException if the locally managed bucket is not primary
    * @see #getLocally(int, Object, Object, boolean, boolean, ClientProxyMembershipID, EntryEventImpl,
boolean)
    */
-  public RawValue getSerializedLocally(KeyInfo keyInfo, boolean doNotLockEntry, EntryEventImpl
clientEvent, boolean returnTombstones, boolean allowReadFromHDFS) throws PrimaryBucketException,
+  public RawValue getSerializedLocally(KeyInfo keyInfo, boolean doNotLockEntry, ClientProxyMembershipID
requestingClient, EntryEventImpl clientEvent, boolean returnTombstones, boolean allowReadFromHDFS)
throws PrimaryBucketException,
       ForceReattemptException {
     final BucketRegion bucketRegion = getInitializedBucketForId(keyInfo.getKey(), keyInfo.getBucketId());
     //  check for primary (when loader is present) done deeper in the BucketRegion
@@ -2125,7 +2125,7 @@ public class PartitionedRegionDataStore implements HasCachePerfStats
     invokeBucketReadHook();
 
     try {
-      RawValue result = bucketRegion.getSerialized(keyInfo, true, doNotLockEntry, clientEvent,
returnTombstones, allowReadFromHDFS);
+      RawValue result = bucketRegion.getSerialized(keyInfo, true, doNotLockEntry, requestingClient,
clientEvent, returnTombstones, allowReadFromHDFS);
       checkIfBucketMoved(bucketRegion);
       return result;
     } catch (RegionDestroyedException rde) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataView.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataView.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataView.java
index 244ecac..25868c8 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataView.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataView.java
@@ -86,7 +86,7 @@ public class PartitionedRegionDataView extends LocalRegionDataView {
   public Object getSerializedValue(LocalRegion localRegion, KeyInfo keyInfo, boolean doNotLockEntry,
ClientProxyMembershipID requestingClient,
   EntryEventImpl clientEvent, boolean returnTombstones, boolean allowReadFromHDFS) throws
DataLocationException {
     PartitionedRegion pr = (PartitionedRegion)localRegion;
-    return pr.getDataStore().getSerializedLocally(keyInfo, doNotLockEntry, clientEvent, returnTombstones,
allowReadFromHDFS);
+    return pr.getDataStore().getSerializedLocally(keyInfo, doNotLockEntry, requestingClient,
clientEvent, returnTombstones, allowReadFromHDFS);
   }
   @Override
   public boolean putEntryOnRemote(EntryEventImpl event, boolean ifNew,

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
index 177a4fe..8215957 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXState.java
@@ -1435,7 +1435,7 @@ public class TXState implements TXStateInterface {
       // so we should never come here
       assert localRegion instanceof PartitionedRegion;
       PartitionedRegion pr = (PartitionedRegion)localRegion;
-      return pr.getDataStore().getSerializedLocally(keyInfo, doNotLockEntry, null, returnTombstones,
allowReadFromHDFS);
+      return pr.getDataStore().getSerializedLocally(keyInfo, doNotLockEntry, null, null,
returnTombstones, allowReadFromHDFS);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
index 99d4b32..b344755 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
@@ -307,7 +307,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
             BucketRegion br = (BucketRegion) r;
             try {
               KeyInfo keyInfo = new KeyInfo(k1, null, bucketId);
-              RawValue rv = br.getSerialized(keyInfo, false, false, null, false, false);
+              RawValue rv = br.getSerialized(keyInfo, false, false, null, null, false, false);
               Object val = rv.getRawValue();
               assertTrue(val instanceof CachedDeserializable);
               CachedDeserializable cd = (CachedDeserializable)val;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ae1ab717/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
index ac4b92e..485783e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
@@ -20,21 +20,28 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.AssertionFailedError;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
 import com.gemstone.gemfire.cache.ClientSession;
 import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
 import com.gemstone.gemfire.cache.InterestRegistrationEvent;
 import com.gemstone.gemfire.cache.InterestRegistrationListener;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -500,6 +507,51 @@ public class InterestListDUnitTest extends DistributedTestCase
         new Object[] { key2 });
   }
 
+  public void testRegisterInterestOnReplicatedRegionWithCacheLoader() {
+    runRegisterInterestWithCacheLoaderTest(true);
+  }
+
+  public void testRegisterInterestOnPartitionedRegionWithCacheLoader() {
+    runRegisterInterestWithCacheLoaderTest(false);
+  }
+
+  private void runRegisterInterestWithCacheLoaderTest(boolean addReplicatedRegion) {
+    // Stop the server (since it was already started with a replicated region)
+    vm0.invoke(InterestListDUnitTest.class, "closeCache");
+
+    // Start two servers with the appropriate region
+    int port1 = ((Integer) vm0.invoke(InterestListDUnitTest.class, "createServerCache", new
Object[] { addReplicatedRegion })).intValue();
+    VM server2VM = Host.getHost(0).getVM(3);
+    int port2 =  ((Integer) server2VM.invoke(InterestListDUnitTest.class, "createServerCache",
new Object[] { addReplicatedRegion })).intValue();
+
+    // Add a cache loader to the region in both cache servers
+    vm0.invoke(InterestListDUnitTest.class, "addCacheLoader");
+    server2VM.invoke(InterestListDUnitTest.class, "addCacheLoader");
+
+    // Create client cache
+    vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
+      getServerHostName(vm0.getHost()), port1, port2});
+    
+    // Register interest in all keys
+    vm1.invoke(InterestListDUnitTest.class, "registerALL_KEYS");
+    
+    // Add CacheListener
+    int numEvents = 100;
+    vm1.invoke(InterestListDUnitTest.class, "addCacheListener", new Object[] {numEvents});
+    
+    // Do gets on the client
+    vm1.invoke(InterestListDUnitTest.class, "doGets", new Object[] {numEvents});
+    
+    // Wait for cache listener create events
+    vm1.invoke(InterestListDUnitTest.class, "waitForCacheListenerCreates");
+    
+    // Confirm there are no cache listener update events
+    vm1.invoke(InterestListDUnitTest.class, "confirmNoCacheListenerUpdates");
+
+    // Confirm there are no cache listener invalidate events
+    vm1.invoke(InterestListDUnitTest.class, "confirmNoCacheListenerInvalidates");
+  }
+  
   private  void createCache(Properties props) throws Exception
   {
     DistributedSystem ds = getSystem(props);
@@ -545,9 +597,21 @@ public class InterestListDUnitTest extends DistributedTestCase
   }
 
   private static void createCache() throws Exception {
+    createCache(true);
+  }
+
+  private static void createCache(boolean addReplicatedRegion) throws Exception {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.DELTA_PROPAGATION_PROP_NAME, "false");
     new InterestListDUnitTest("temp").createCache(props);
+    if (addReplicatedRegion) {
+      addReplicatedRegion();
+    } else {
+      addPartitionedRegion();
+    }
+  }
+
+  private static void addReplicatedRegion() {
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableSubscriptionConflation(true);
@@ -556,6 +620,10 @@ public class InterestListDUnitTest extends DistributedTestCase
     cache.createRegion(REGION_NAME, attrs);
   }
 
+  private static void addPartitionedRegion() {
+    cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).create(REGION_NAME);
+  }
+
   private static CacheServer addCacheServer() throws Exception {
     CacheServer s = cache.addCacheServer();
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET) ;
@@ -568,7 +636,11 @@ public class InterestListDUnitTest extends DistributedTestCase
   // most of these tests resides.  This server is held in the
   // static variable 'server1'
   public static Integer createServerCache() throws Exception {
-    createCache();
+    return createServerCache(true);
+  }
+
+  public static Integer createServerCache(boolean addReplicatedRegion) throws Exception {
+    createCache(addReplicatedRegion);
     server = addCacheServer();
     return new Integer(server.getPort());
   }
@@ -598,6 +670,59 @@ public class InterestListDUnitTest extends DistributedTestCase
     }
   }
 
+  private static void addCacheLoader() {
+    // Add a cache loader
+    Region region = cache.getRegion(REGION_NAME);
+    region.getAttributesMutator().setCacheLoader(new ReturnKeyCacheLoader());
+  }
+
+  private static void addCacheListener(int expectedCreates) {
+    // Add a cache listener to count the number of create and update events
+    Region region = cache.getRegion(REGION_NAME);
+    region.getAttributesMutator().setCacheListener(new EventCountingCacheListener(expectedCreates));
+  }
+
+  private static void doGets(int numGets) {
+    // Do gets.
+    // These gets cause the CacheLoader to be invoked on the server
+    Region region = cache.getRegion(REGION_NAME);
+    for (int i=0; i<numGets; i++) {
+      region.get(i);
+    }
+  }
+  
+  private static void waitForCacheListenerCreates() throws Exception {
+    // Wait for the EventCountingCacheListener to receive all of its create events
+    Region region = cache.getRegion(REGION_NAME);
+    final EventCountingCacheListener fCacheListener = (EventCountingCacheListener) region.getAttributes().getCacheListener();
+  
+    WaitCriterion ev = new WaitCriterion() {
+      public boolean done() {
+        return fCacheListener.hasReceivedAllCreateEvents();
+      }
+      public String description() {
+        return "waiting for " + fCacheListener.getExpectedCreates() + " create events";
+      }
+    };
+    DistributedTestCase.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
+  }
+  
+  private static void confirmNoCacheListenerUpdates() throws Exception {
+    // Confirm there are no EventCountingCacheListener update events.
+    // These would be coming from the subscription channel.
+    Region region = cache.getRegion(REGION_NAME);
+    EventCountingCacheListener cacheListener = (EventCountingCacheListener) region.getAttributes().getCacheListener();
+    assertEquals(0/*expected*/, cacheListener.getUpdates()/*actual*/);
+  }
+  
+  private static void confirmNoCacheListenerInvalidates() throws Exception {
+    // Confirm there are no EventCountingCacheListener invalidate events.
+    // These would be coming from the subscription channel.
+    Region region = cache.getRegion(REGION_NAME);
+    EventCountingCacheListener cacheListener = (EventCountingCacheListener) region.getAttributes().getCacheListener();
+    assertEquals(0/*expected*/, cacheListener.getInvalidates()/*actual*/);
+  }
+
   public static void verifyCountsAndClear(int count1, int count2) {
     interestListener.verifyCountsAndClear(count1, count2);
   }
@@ -1008,4 +1133,78 @@ public class InterestListDUnitTest extends DistributedTestCase
     public InterestListener() {
     }
   }
+  
+  private static class EventCountingCacheListener extends CacheListenerAdapter {
+
+    private AtomicInteger creates = new AtomicInteger();
+
+    private AtomicInteger updates = new AtomicInteger();
+
+    private AtomicInteger invalidates = new AtomicInteger();
+
+    private int expectedCreates;
+    
+    public EventCountingCacheListener(int expectedCreates) {
+      this.expectedCreates = expectedCreates;
+    }
+
+    public int getExpectedCreates() {
+      return this.expectedCreates;
+    }
+
+    public void afterCreate(EntryEvent event) {
+      incrementCreates();
+    }
+
+    public void afterUpdate(EntryEvent event) {
+      incrementUpdates();
+      event.getRegion().getCache().getLogger().warning("Received update event " + getUpdates()
+ " for " + event.getKey());
+    }
+
+    public void afterInvalidate(EntryEvent event) {
+      incrementInvalidates();
+      event.getRegion().getCache().getLogger().warning("Received invalidate event " + getInvalidates()
+ " for " + event.getKey());
+    }
+
+    private void incrementCreates() {
+      this.creates.incrementAndGet();
+    }
+    
+    private int getCreates() {
+      return this.creates.get();
+    }
+
+    private void incrementUpdates() {
+      this.updates.incrementAndGet();
+    }
+    
+    private int getUpdates() {
+      return this.updates.get();
+    }
+
+    private void incrementInvalidates() {
+      this.invalidates.incrementAndGet();
+    }
+
+    private int getInvalidates() {
+      return this.invalidates.get();
+    }
+
+    public boolean hasReceivedAllCreateEvents() {
+      return this.expectedCreates == getCreates();
+    }
+  }
+  
+  private static class ReturnKeyCacheLoader implements CacheLoader {
+
+    @Override
+    public void close() {
+      // Do nothing
+    }
+  
+    @Override
+    public Object load(LoaderHelper helper) throws CacheLoaderException {
+      return helper.getKey();
+    }
+  }
 }


Mime
View raw message