Examples of canExpire()


Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

      InternalCacheEntry e = immortalEntries.get(k);
      if (e != null) {
         e.setValue(v);
         e = entryFactory.update(e, lifespan, maxIdle);

         if (e.canExpire()) {
            immortalEntries.remove(k);
            mortalEntries.put(k, e);
         }
         successfulPut(e, false);
      } else {
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

               boolean found = false;
               long currentTimeMillis = 0;
               while (it2.hasNext()) {
                  InternalCacheEntry ice = it2.next();
                  Object key = ice.getKey();
                  if (ice.canExpire()) {
                     if (currentTimeMillis == 0)
                        currentTimeMillis = timeService.wallClockTime();
                     if (ice.isExpired(currentTimeMillis))
                        continue;
                  }
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

         private void fetchNext() {
            long currentTimeMillis = 0;
            while (it.hasNext()) {
               InternalCacheEntry e = it.next();
               final boolean canExpire = e.canExpire();
               if (canExpire && currentTimeMillis == 0) {
                  currentTimeMillis = timeService.wallClockTime();
               }
               if (!canExpire) {
                  next = e.getValue();
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

   @Test
   public void testDefaultExpiration() throws Exception {
      remoteCache.put("Key", "Value");
      InternalCacheEntry entry = getInternalCacheEntry(cache, "Key", "Value");
      assertTrue(entry.canExpire());
      assertEquals(3000, entry.getLifespan());
      assertEquals(2000, entry.getMaxIdle());
      Thread.sleep(5000);
      assertFalse(remoteCache.containsKey("Key"));
   }
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

   }

   @Override
   public InternalCacheEntry get(Object k) {
      InternalCacheEntry e = peek(k);
      if (e != null && e.canExpire()) {
         long currentTimeMillis = System.currentTimeMillis();
         if (e.isExpired(currentTimeMillis)) {
            entries.remove(k);
            e = null;
         } else {
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

   }

   @Override
   public boolean containsKey(Object k) {
      InternalCacheEntry ice = peek(k);
      if (ice != null && ice.canExpire() && ice.isExpired(System.currentTimeMillis())) {
         entries.remove(k);
         ice = null;
      }
      return ice != null;
   }
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

   }

   @Override
   public InternalCacheEntry remove(Object k) {
      InternalCacheEntry e = entries.remove(k);
      return e == null || (e.canExpire() && e.isExpired(System.currentTimeMillis())) ? null : e;
   }

   @Override
   public int size() {
      return entries.size();
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

      if (e != null) {
         e.setValue(v);
         if (lifespan > -1) e = e.setLifespan(lifespan);
         if (maxIdle > -1) e = e.setMaxIdle(maxIdle);

         if (e.canExpire()) {
            immortalEntries.remove(k);
            mortalEntries.put(k, e);
         }
      } else {
         e = mortalEntries.get(k);
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

         } else if (o instanceof InternalCacheEntry) {
            out.writeByte(MAGICNUMBER_INTERNAL_CACHED_ENTRY);
            InternalCacheEntry ice = (InternalCacheEntry) o;
            marshallObject(ice.getKey(), out, refMap);
            marshallObject(ice.getValue(), out, refMap);
            if (ice.canExpire()) {
               out.writeBoolean(true);
               writeUnsignedLong(out, ice.getCreated());
               out.writeLong(ice.getLifespan()); // could be negative so should not use unsigned longs
               writeUnsignedLong(out, ice.getLastUsed());
               out.writeLong(ice.getMaxIdle()); // could be negative so should not use unsigned longs
View Full Code Here

Examples of org.infinispan.container.entries.InternalCacheEntry.canExpire()

   public void writeExternal(Object subject, ObjectOutput output) throws IOException {
      InternalCacheEntry ice = (InternalCacheEntry) subject;
      output.writeObject(ice.getKey());
      output.writeObject(ice.getValue());
      if (ice.canExpire()) {
         output.writeBoolean(true);
         MarshallUtil.writeUnsignedLong(output, ice.getCreated());
         output.writeLong(ice.getLifespan()); // could be negative so should not use unsigned longs
         MarshallUtil.writeUnsignedLong(output, ice.getLastUsed());
         output.writeLong(ice.getMaxIdle()); // could be negative so should not use unsigned longs
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.