Package org.infinispan.container.entries

Examples of org.infinispan.container.entries.InternalCacheEntry


   @Override
   public Set<InternalCacheEntry> load(int numEntries) throws CacheLoaderException {
      Set<InternalCacheEntry> result = new HashSet<InternalCacheEntry>();
      for (Object key : loadAllKeys(null)) {
         InternalCacheEntry entry = load(key);
         if (entry != null) {
            result.add(entry);
            if (result.size() == numEntries)
               return result;
         }
View Full Code Here


   protected InternalCacheEntry loadLockSafe(Object key, Integer lockingKey) throws CacheLoaderException {
      Bucket bucket = loadBucket(lockingKey);
      if (bucket == null) {
         return null;
      }
      InternalCacheEntry se = bucket.getEntry(key);

      if (se != null && se.canExpire() && se.isExpired(timeService.wallClockTime())) {
         // We do not actually remove expired items from the store here.  We leave that up to the implementation,
         // since it may be a costly thing (remote connection, row locking on a JDBC store for example) for a
         // supposedly quick load operation.
         return null;
      } else {
View Full Code Here

   @Override
   public Set<InternalCacheEntry> load(int numEntries) throws CacheLoaderException {
      Set<Object> keys = loadAllKeys(null);
      Set<InternalCacheEntry> result = new HashSet<InternalCacheEntry>();
      for (Object key : keys) {
         InternalCacheEntry ice = load(key);
         if (ice != null) {
            result.add(ice);
            if (result.size() >= numEntries)
               return result;
         }
View Full Code Here

         }
      }
   }

   private void assertValue(int cacheIndex, int key, String expectedValue) {
      InternalCacheEntry ice = cache(cacheIndex).getAdvancedCache().getDataContainer().get(key);
      assertNotNull("Found null on cache " + cacheIndex,  ice);
      assertEquals("Did not find the expected value on cache " + cacheIndex, expectedValue, ice.getValue());
      assertEquals("Did not find the expected value on cache " + cacheIndex, expectedValue, cache(cacheIndex).get(key));
   }
View Full Code Here

         Object expectedValue = key;
         if (key.equals(migratedKey)) {
            expectedValue = "someValue";
         }
         // check them directly in data container
         InternalCacheEntry d0 = advancedCache(0).getDataContainer().get(key);
         InternalCacheEntry d1 = advancedCache(1).getDataContainer().get(key);
         InternalCacheEntry d2 = advancedCache(2).getDataContainer().get(key);
         int c = 0;
         if (d0 != null && !d0.isExpired()) {
            assertEquals(expectedValue, d0.getValue());
            c++;
         }
         if (d1 != null && !d1.isExpired()) {
            assertEquals(expectedValue, d1.getValue());
            c++;
         }
         if (d2 != null && !d2.isExpired()) {
            assertEquals(expectedValue, d2.getValue());
            c++;
         }
         assertEquals(1, c);

         // look at them also via cache API
View Full Code Here

   }

   protected void assertOwnershipAndNonOwnership(Object key, boolean allowL1) {
      for (Cache<Object, String> c : caches) {
         DataContainer dc = c.getAdvancedCache().getDataContainer();
         InternalCacheEntry ice = dc.get(key);
         if (isOwner(c, key)) {
            assert ice != null : "Fail on owner cache " + addressOf(c) + ": dc.get(" + key + ") returned null!";
            assert ice instanceof ImmortalCacheEntry : "Fail on owner cache " + addressOf(c) + ": dc.get(" + key + ") returned " + safeType(ice);
         } else {
            if (allowL1) {
View Full Code Here

      assert created;
   }

   public void testBucketRemoval() throws Exception {
      Bucket b;
      InternalCacheEntry se = TestInternalCacheEntryFactory.create("test", "value");
      fcs.store(se);
      b = fcs.loadBucketContainingKey("test");
      assert b != null;

      assert !b.getEntries().isEmpty();
View Full Code Here

      checkBucketExists(b);
   }

   public void testCacheStoreRebootable() throws Exception {
      String key = "testCacheStoreRebootable";
      InternalCacheEntry se = TestInternalCacheEntryFactory.create(key, "initialValue");
      fcs.store(se);
      Bucket b = fcs.loadBucketContainingKey(key);

      //stop and restart it:
      fcs.stop();
      fcs.start();

      InternalCacheEntry entry = b.getEntry(key);
      entry.setValue("updatedValue");
      fcs.updateBucket(b);
      assert "updatedValue".equals(fcs.load(key).getValue());
   }
View Full Code Here

   private void checkVersion(Cache<Object, Object> c, MagicKey hello) {
      Address address = c.getCacheManager().getAddress();
      ConsistentHash readConsistentHash = c.getAdvancedCache().getDistributionManager().getReadConsistentHash();
      if (readConsistentHash.isKeyLocalToNode(address, hello)) {
         InternalCacheEntry ice = c.getAdvancedCache().getDataContainer().get(hello);
         assert ice != null;
         assert ice.getVersion() != null;
      }
   }
View Full Code Here

      return o.getClass().getSimpleName();
   }

   public static void assertIsInL1(Cache<?, ?> cache, Object key) {
      DataContainer dc = cache.getAdvancedCache().getDataContainer();
      InternalCacheEntry ice = dc.get(key);
      assert ice != null : "Entry for key [" + key + "] should be in L1 on cache at [" + addressOf(cache) + "]!";
      assert !(ice instanceof ImmortalCacheEntry) : "Entry for key [" + key + "] should have a lifespan on cache at [" + addressOf(cache) + "]!";
   }
View Full Code Here

TOP

Related Classes of org.infinispan.container.entries.InternalCacheEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.