Package org.infinispan

Examples of org.infinispan.Metadata


   public final MVCCEntry wrapEntryForPut(InvocationContext ctx, Object key, InternalCacheEntry icEntry,
         boolean undeleteIfNeeded, FlagAffectedCommand cmd) throws InterruptedException {
      CacheEntry cacheEntry = getFromContext(ctx, key);
      MVCCEntry mvccEntry;
      if (cacheEntry != null && cacheEntry.isNull()) cacheEntry = null;
      Metadata providedMetadata = extractMetadata(cmd);
      if (cacheEntry != null) {
         mvccEntry = wrapMvccEntryForPut(ctx, key, cacheEntry, providedMetadata);
         mvccEntry.undelete(undeleteIfNeeded);
      } else {
         InternalCacheEntry ice = (icEntry == null ? getFromContainer(key) : icEntry);
View Full Code Here


   }

   protected MVCCEntry createWrappedEntry(Object key, CacheEntry cacheEntry,
         Metadata providedMetadata, boolean isForInsert, boolean forRemoval) {
      Object value = cacheEntry != null ? cacheEntry.getValue() : null;
      Metadata metadata = providedMetadata != null
            ? providedMetadata
            : cacheEntry != null ? cacheEntry.getMetadata() : null;

      if (value == null && !isForInsert) return useRepeatableRead ?
            forRemoval ? new NullMarkerEntryForRemoval(key, metadata) : NullMarkerEntry.getInstance()
View Full Code Here

   @Override
   protected void commitContextEntry(CacheEntry entry, InvocationContext ctx, FlagAffectedCommand command, Metadata metadata) {
      if (ctx.isInTxScope() && !isFromStateTransfer(ctx)) {
         EntryVersion updatedEntryVersion = ((TxInvocationContext) ctx)
               .getCacheTransaction().getUpdatedEntryVersions().get(entry.getKey());
         Metadata commitMetadata;
         if (metadata == null)
            commitMetadata = new EmbeddedMetadata.Builder().version(updatedEntryVersion).build();
         else
            commitMetadata = metadata.builder().version(updatedEntryVersion).build();
View Full Code Here

            boolean isForeignOwned = !skipOwnershipCheck && !localNodeIsOwner(entry.getKey());
            if (isForeignOwned && !entry.isRemoved()) {
               if (configuration.clustering().l1().enabled()) {
                  // transform for L1
                  if (entry.getLifespan() < 0 || entry.getLifespan() > configuration.clustering().l1().lifespan()) {
                     Metadata newMetadata = entry.getMetadata().builder()
                           .lifespan(configuration.clustering().l1().lifespan(),
                                 TimeUnit.MILLISECONDS)
                           .build();
                     entry.setMetadata(newMetadata);
                  }
View Full Code Here

         final Object value = loadedEntry.getValue();
         // FIXME: There's no point to trigger the entryLoaded/Activated event twice.
         sendNotification(key, value, true, ctx, cmd);
         entry.setValue(value);

         Metadata metadata = extractMetadata(cmd);
         Metadata loadedMetadata = loadedEntry.getMetadata();
         if (metadata != null && loadedMetadata != null)
            metadata = metadata.builder().read(loadedMetadata).build();
         else if (metadata == null)
            metadata = loadedMetadata;
View Full Code Here

   }

   @Override
   protected void commitContextEntry(CacheEntry entry, InvocationContext ctx, FlagAffectedCommand command, Metadata metadata) {
      if (ctx.isInTxScope() && !isFromStateTransfer(ctx)) {
         Metadata commitMetadata;
         // If user provided version, use it, otherwise generate/increment accordingly
         ClusteredRepeatableReadEntry clusterMvccEntry = (ClusteredRepeatableReadEntry) entry;
         EntryVersion existingVersion = clusterMvccEntry.getMetadata().version();
         EntryVersion newVersion;
         if (existingVersion == null) {
View Full Code Here

         if (lifespan > -1 && maxIdle < 0) return new MortalCacheEntry(key, value, lifespan, created);
         if (lifespan < 0 && maxIdle > -1) return new TransientCacheEntry(key, value, maxIdle, lastUsed);
         return new TransientMortalCacheEntry(key, value, maxIdle, lifespan, lastUsed, created);
      } else {
         // If no metadata passed, assumed embedded metadata
         Metadata metadata = new EmbeddedMetadata.Builder()
               .lifespan(lifespan, TimeUnit.MILLISECONDS)
               .maxIdle(maxIdle, TimeUnit.MILLISECONDS)
               .version(version).build();
         if (lifespan < 0 && maxIdle < 0) return new MetadataImmortalCacheEntry(key, value, metadata);
         if (lifespan > -1 && maxIdle < 0) return new MetadataMortalCacheEntry(key, value, metadata, created);
View Full Code Here

      }
   }

   @Override
   public InternalCacheValue createValue(CacheEntry cacheEntry) {
      Metadata metadata = cacheEntry.getMetadata();
      long lifespan = cacheEntry.getLifespan();
      long maxIdle = cacheEntry.getMaxIdle();
      if (!isStoreMetadata(metadata)) {
         if (lifespan < 0 && maxIdle < 0) return new ImmortalCacheValue(cacheEntry.getValue());
         if (lifespan > -1 && maxIdle < 0) return new MortalCacheValue(cacheEntry.getValue(), -1, lifespan);
View Full Code Here

         try {
            long l1Lifespan = cacheConfiguration.clustering().l1().lifespan();
            long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan);
            // Make a copy of the metadata stored internally, adjust
            // lifespan/maxIdle settings and send them a modification
            Metadata newMetadata = ice.getMetadata().builder()
                  .lifespan(lifespan, TimeUnit.MILLISECONDS)
                  .maxIdle(-1, TimeUnit.MILLISECONDS).build();
            PutKeyValueCommand put = cf.buildPutKeyValueCommand(ice.getKey(), ice.getValue(),
                  newMetadata, Collections.singleton(Flag.CACHE_MODE_LOCAL));
            lockAndWrap(ctx, command.getKey(), ice, command);
View Full Code Here

               try {
                  long l1Lifespan = cacheConfiguration.clustering().l1().lifespan();
                  long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan);
                  // Make a copy of the metadata stored internally, adjust
                  // lifespan/maxIdle settings and send them a modification
                  Metadata newMetadata = ice.getMetadata().builder()
                        .lifespan(lifespan, TimeUnit.MILLISECONDS)
                        .maxIdle(-1, TimeUnit.MILLISECONDS).build();
                  PutKeyValueCommand put = cf.buildPutKeyValueCommand(
                        ice.getKey(), ice.getValue(), newMetadata, command.getFlags());
                  lockAndWrap(ctx, key, ice, command);
View Full Code Here

TOP

Related Classes of org.infinispan.Metadata

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.