Package org.infinispan.container.versioning

Examples of org.infinispan.container.versioning.EntryVersion


            if (ksl.performCheckOnKey(k)) {
               ClusteredRepeatableReadEntry entry = (ClusteredRepeatableReadEntry) context.lookupEntry(k);

               if (!context.isOriginLocal()) {
                  // What version did the transaction originator see??
                  EntryVersion versionSeen = prepareCommand.getVersionsSeen().get(k);
                  if (versionSeen != null) entry.setVersion(versionSeen);
               }

               if (entry.performWriteSkewCheck(dataContainer)) {
                  IncrementableEntryVersion newVersion = entry.isCreated() ? versionGenerator.generateNew() : versionGenerator.increment((IncrementableEntryVersion) entry.getVersion());
View Full Code Here


            if (ksl.performCheckOnKey(k)) {
               ClusteredRepeatableReadEntry entry = (ClusteredRepeatableReadEntry) context.lookupEntry(k);

               if (!context.isOriginLocal()) {
                  // What version did the transaction originator see??
                  EntryVersion versionSeen = prepareCommand.getVersionsSeen().get(k);
                  if (versionSeen != null) entry.setVersion(versionSeen);
               }

               if (entry.performWriteSkewCheck(dataContainer)) {
                  IncrementableEntryVersion newVersion = entry.isCreated() ? versionGenerator.generateNew() : versionGenerator.increment((IncrementableEntryVersion) entry.getVersion());
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
View Full Code Here

   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) {
            newVersion = versionGenerator.generateNew();
         } else {
            newVersion = versionGenerator.increment((IncrementableEntryVersion) existingVersion);
         }
View Full Code Here

      @Override
      public EmbeddedMetadata readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         long lifespan = input.readLong();
         long maxIdle = input.readLong();
         EntryVersion version = (EntryVersion) input.readObject();
         return new EmbeddedMetadata(lifespan, TimeUnit.MILLISECONDS,
               maxIdle, TimeUnit.MILLISECONDS,
               version);
      }
View Full Code Here

               return new EmbeddedMetadata(
                     (EntryVersion) input.readObject());
            case EXPIRABLE:
               long lifespan = input.readLong();
               long maxIdle = input.readLong();
               EntryVersion version = (EntryVersion) input.readObject();
               return new EmbeddedExpirableMetadata(
                     lifespan, TimeUnit.MILLISECONDS,
                     maxIdle, TimeUnit.MILLISECONDS, version);
            default:
               throw new IllegalStateException("Unknown metadata type " + number);
View Full Code Here

      } else {
         if (ctx.isInTxScope()) {
            EntryVersionsMap updatedVersions =
                  ((TxInvocationContext) ctx).getCacheTransaction().getUpdatedEntryVersions();
            if (updatedVersions != null) {
               EntryVersion version = updatedVersions.get(entry.getKey());
               if (version != null) {
                  Metadata metadata = entry.getMetadata();
                  if (metadata == null) {
                     // If no metadata passed, assumed embedded metadata
                     metadata = new EmbeddedMetadata.Builder()
View Full Code Here

         return;
      }
      if (versionsSeenMap == null) {
         versionsSeenMap = new EntryVersionsMap();
      }
      EntryVersion oldVersion = versionsSeenMap.put(key, (IncrementableEntryVersion) version);
      if (log.isTraceEnabled()) {
         log.tracef("Transaction %s replaced version for key %s. old=%s, new=%s", getGlobalTransaction().globalId(), key,
                    oldVersion, version);
      }
   }
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 (updatedEntryVersion != null) {
            if (metadata == null && entry.getMetadata() == null)
               commitMetadata = new EmbeddedMetadata.Builder().version(updatedEntryVersion).build();
View Full Code Here

      return new VersionedTransientMortalCacheEntry(key, value, version, maxIdle, lifespan);
   }

   @Override
   public InternalCacheEntry update(InternalCacheEntry ice, long lifespan, long maxIdle) {
      EntryVersion version = ice.getVersion();
      if (ice instanceof ImmortalCacheEntry) {
         if (lifespan < 0) {
            if (maxIdle < 0) {
               return ice;
            } else {
View Full Code Here

TOP

Related Classes of org.infinispan.container.versioning.EntryVersion

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.