Examples of InternalMetadata


Examples of org.infinispan.metadata.InternalMetadata

         getLog().tracef("Loaded %s for key %s from persistence.", loaded, key);
      }
      if(loaded == null) {
         return null;
      }
      InternalMetadata metadata = loaded.getMetadata();
      if (metadata != null && metadata.isExpired(timeService.wallClockTime())) {
         return null;
      }
      return loaded;
   }
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

                  sameKeyMultipleTimes.set(true);
               }
            }
            if (marshalledEntry.getMetadata() != null) {
               log.tracef("For key %d found metdata %s", key, marshalledEntry.getMetadata());
               InternalMetadata prevMetadata = metadata.put(key, marshalledEntry.getMetadata());
               if (prevMetadata != null) {
                  log.warnf("Already a metadata present for key %s: %s", key, prevMetadata);
                  sameKeyMultipleTimes.set(true);
               }
            } else {
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

            Object entity = em.find(configuration.entityClass(), key);
            stats.addEntityFind(timeService.time() - entityFindBegin);
            try {
               if (entity == null)
                  return null;
               InternalMetadata m = null;
               if (configuration.storeMetadata()) {
                  byte[] keyBytes;
                  try {
                     keyBytes = marshaller.objectToByteBuffer(key);
                  } catch (Exception e) {
                     throw new JpaStoreException("Failed to marshall key", e);
                  }
                  long metadataFindBegin = timeService.time();
                  MetadataEntity metadata = em.find(MetadataEntity.class, keyBytes);
                  stats.addMetadataFind(timeService.time() - metadataFindBegin);
                  if (metadata != null && metadata.getMetadata() != null) {
                     try {
                        m = (InternalMetadata) marshaller.objectFromByteBuffer(metadata.getMetadata());
                     } catch (Exception e) {
                        throw new JpaStoreException("Failed to unmarshall metadata", e);
                     }
                     if (m.isExpired(timeService.wallClockTime())) {
                        return null;
                     }
                  }
               }
               if (trace) log.trace("Loaded " + entity + " (" + m + ")");
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

               continue;
            }
            EntityTransaction txn = em.getTransaction();

            Object tempEntity = null;
            InternalMetadata tempMetadata = null;
            boolean loaded = false;
            txn.begin();
            try {
               do {
                  try {
                     tempEntity = fetchValue ? em.find(configuration.entityClass(), key) : null;
                     tempMetadata = fetchMetadata ? getMetadata(em, key) : null;
                  } finally {
                     try {
                        txn.commit();
                        loaded = true;
                     } catch (Exception e) {
                        log.trace("Failed to load once", e);
                     }
                  }
               } while (!loaded);
            } finally {
               if (txn != null && txn.isActive())
                  txn.rollback();
            }
            final Object entity = tempEntity;
            final InternalMetadata metadata = tempMetadata;
            if (trace) log.trace("Processing " + key + " -> " + entity + "(" + metadata + ")");

            if (metadata != null && metadata.isExpired(timeService.wallClockTime())) continue;
            eacs.submit(new Callable<Void>() {
               @Override
               public Void call() throws Exception {
                  try {
                     final MarshalledEntry marshalledEntry = marshallerEntryFactory.newMarshalledEntry(key, entity, metadata);
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

   }

   @Override
   public final void write(MarshalledEntry entry) {
      log.tracef("store(%s)", entry);
      InternalMetadata m = entry.getMetadata();

      if (m != null && m.isExpired(ctx.getTimeService().wallClockTime())) {
         delete(entry.getKey());
         return;
      }

      Integer bucketId = getBuckedId(entry.getKey());
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

   @Override
   public void write(MarshalledEntry me)  {
      try {
         db.put(marshall(me.getKey()), marshall(me));
         InternalMetadata meta = me.getMetadata();
         if (meta != null && meta.expiryTime() > -1) {
            addNewExpiry(me);
         }
      } catch (Exception e) {
         throw new DBException(e);
      }
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

   public MarshalledEntry load(Object key)  {
      try {
         MarshalledEntry me = (MarshalledEntry) unmarshall(db.get(marshall(key)));
         if (me == null) return null;

         InternalMetadata meta = me.getMetadata();
         if (meta != null && meta.isExpired(ctx.getTimeService().wallClockTime())) {
            return null;
         }
         return me;
      } catch (Exception e) {
         throw new PersistenceException(e);
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

   }

   @Override
   public final void write(MarshalledEntry entry) {
      log.tracef("store(%s)", entry);
      InternalMetadata m = entry.getMetadata();

      if (m != null && m.isExpired(ctx.getTimeService().wallClockTime())) {
         delete(entry.getKey());
         return;
      }

      Integer bucketId = getBuckedId(entry.getKey());
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

      CacheEntry e = ctx.lookupEntry(key);
      if (e == null || e.isNull() || e.getValue() == null) {
         MarshalledEntry loaded = persistenceManager.loadFromAllStores(key);
         if(loaded == null)
            return Boolean.FALSE;
         InternalMetadata metadata = loaded.getMetadata();
         if (metadata != null && metadata.isExpired(timeService.wallClockTime())) {
            return Boolean.FALSE;
         }
         InternalCacheEntry ice = iceFactory.create(loaded.getKey(), loaded.getValue(), metadata);
         CacheEntry wrappedEntry;
         if (cmd instanceof ApplyDeltaCommand) {
View Full Code Here

Examples of org.infinispan.metadata.InternalMetadata

      CacheEntry e = ctx.lookupEntry(key);
      if (e == null || e.isNull() || e.getValue() == null) {
         MarshalledEntry loaded = persistenceManager.loadFromAllStores(key);
         if(loaded == null)
            return Boolean.FALSE;
         InternalMetadata metadata = loaded.getMetadata();
         if (metadata != null && metadata.isExpired(timeService.wallClockTime())) {
            return Boolean.FALSE;
         }
         InternalCacheEntry ice = iceFactory.create(loaded.getKey(), loaded.getValue(), metadata);
         CacheEntry wrappedEntry;
         if (cmd instanceof ApplyDeltaCommand) {
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.