Package org.infinispan.container.versioning

Examples of org.infinispan.container.versioning.EntryVersion


      super(key, value, version, lifespan);
      this.version = version;
   }

   public boolean performWriteSkewCheck(DataContainer container, TxInvocationContext ctx, boolean previousRead) {
      EntryVersion prevVersion;
      InternalCacheEntry ice = container.get(key);
      if (ice == null) {
         log.tracef("No entry for key %s found in data container" , key);
         prevVersion = ctx.getCacheTransaction().getLookedUpRemoteVersion(key);
         if (prevVersion == null) {
            log.tracef("No looked up remote version for key %s found in context" , key);
            return version == null;
         }
      } else {
         prevVersion = ice.getVersion();
         if (prevVersion == null)
            throw new IllegalStateException("Entries cannot have null versions!");
      }
      if (log.isTraceEnabled()) {
         log.tracef("Is going to compare versions %s and %s for key %s. Was previously read? %s", prevVersion, version, key, previousRead);
      }
      // Could be that we didn't do a remote get first ... so we haven't effectively read this entry yet.
      if (version == null) return !previousRead;
      log.tracef("Comparing versions %s and %s for key %s: %s", prevVersion, version, key, prevVersion.compareTo(version));
      return InequalVersionComparisonResult.AFTER != prevVersion.compareTo(version);
   }
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

   }

   @Override
   protected void commitContextEntry(CacheEntry entry, InvocationContext ctx, boolean skipOwnershipCheck) {
      if (ctx.isInTxScope()) {
         EntryVersion version = ((TxInvocationContext) ctx).getCacheTransaction().getUpdatedEntryVersions().get(entry.getKey());
         cll.commitEntry(entry, version, skipOwnershipCheck);
      } else {
         // This could be a state transfer call!
         cll.commitEntry(entry, entry.getVersion(), skipOwnershipCheck);
      }
View Full Code Here

               if (localNodeIsPrimaryOwner(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
      public MortalCacheValue readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         long created = UnsignedNumeric.readUnsignedLong(input);
         Long lifespan = input.readLong();
         return new MortalCacheValue(v, version, created, lifespan);
      }
View Full Code Here

      }

      @Override
      public TransientCacheValue readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         long lastUsed = UnsignedNumeric.readUnsignedLong(input);
         Long maxIdle = input.readLong();
         return new TransientCacheValue(v, version, maxIdle, lastUsed);
      }
View Full Code Here

      @Override
      public MortalCacheEntry readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object k = input.readObject();
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         long created = UnsignedNumeric.readUnsignedLong(input);
         Long lifespan = input.readLong();
         return new MortalCacheEntry(k, v, version, lifespan, created);
      }
View Full Code Here

      }

      @Override
      public TransientMortalCacheValue readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         long created = UnsignedNumeric.readUnsignedLong(input);
         Long lifespan = input.readLong();
         long lastUsed = UnsignedNumeric.readUnsignedLong(input);
         Long maxIdle = input.readLong();
         return new TransientMortalCacheValue(v, version, created, lifespan, maxIdle, lastUsed);
View Full Code Here

      @Override
      public TransientCacheEntry readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object k = input.readObject();
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         long lastUsed = UnsignedNumeric.readUnsignedLong(input);
         Long maxIdle = input.readLong();
         return new TransientCacheEntry(k, v, version, maxIdle, lastUsed);
      }
View Full Code Here

      @Override
      public ImmortalCacheEntry readObject(ObjectInput input) throws IOException, ClassNotFoundException {
         Object k = input.readObject();
         Object v = input.readObject();
         EntryVersion version = (EntryVersion) input.readObject();
         return new ImmortalCacheEntry(k, v, version);
      }
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.