Package org.infinispan.commands.write

Examples of org.infinispan.commands.write.PutKeyValueCommand


         log.tracef("Caching remotely retrieved entry for key %s in L1", command.getKey());
         // This should be fail-safe
         try {
            long l1Lifespan = cacheConfiguration.clustering().l1().lifespan();
            long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan);
            PutKeyValueCommand put = cf.buildPutKeyValueCommand(ice.getKey(), ice.getValue(), lifespan, -1, Collections.singleton(Flag.CACHE_MODE_LOCAL));
            lockAndWrap(ctx, command.getKey(), ice, command);
            invokeNextInterceptor(ctx, put);
         } catch (Exception e) {
            // Couldn't store in L1 for some reason.  But don't fail the transaction!
            log.infof("Unable to store entry %s in L1 cache", command.getKey());
View Full Code Here


               if (trace) log.tracef("Caching remotely retrieved entry for key %s in L1", key);
               // This should be fail-safe
               try {
                  long l1Lifespan = cacheConfiguration.clustering().l1().lifespan();
                  long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan);
                  PutKeyValueCommand put = cf.buildPutKeyValueCommand(ice.getKey(), ice.getValue(), lifespan, -1, command.getFlags());
                  lockAndWrap(ctx, key, ice, command);
                  invokeNextInterceptor(ctx, put);
               } catch (Exception e) {
                  // Couldn't store in L1 for some reason.  But don't fail the transaction!
                  log.infof("Unable to store entry %s in L1 cache", key);
View Full Code Here

      this.totalOrderProtocol = configuration.transaction().transactionProtocol().isTotalOrder();
   }

   @Override
   public PutKeyValueCommand buildPutKeyValueCommand(Object key, Object value, long lifespanMillis, long maxIdleTimeMillis, Set<Flag> flags) {
      return new PutKeyValueCommand(key, value, false, notifier, lifespanMillis, maxIdleTimeMillis, flags);
   }
View Full Code Here

         EnumSet<Flag> explicitFlags, InvocationContext ctx,
         EntryVersion version) {
      assertKeyValueNotNull(key, value);
      long lifespanMillis = lifespanUnit.toMillis(lifespan);
      long maxIdleTimeMillis = idleTimeUnit.toMillis(maxIdleTime);
      PutKeyValueCommand command = buildPutKeyValueCommand(key, value,
            explicitFlags, version, lifespanMillis, maxIdleTimeMillis);
      return (V) executeCommandAndCommitIfNeeded(ctx, command);
   }
View Full Code Here

         EnumSet<Flag> explicitFlags, InvocationContext ctx, EntryVersion version) {
      assertKeyValueNotNull(key, value);
      // putForExternalRead calls only here, so only check here
      long lifespanMillis = lifespanUnit.toMillis(lifespan);
      long maxIdleTimeMillis = idleTimeUnit.toMillis(maxIdleTime);
      PutKeyValueCommand command = buildPutKeyValueCommand(key, value,
            explicitFlags, version, lifespanMillis, maxIdleTimeMillis);
      command.setPutIfAbsent(true);
      return (V) executeCommandAndCommitIfNeeded(ctx, command);
   }
View Full Code Here

            } else {
               // non-tx cache
               ctx = icc.createSingleKeyNonTxInvocationContext();
            }

            PutKeyValueCommand put = useVersionedPut ?
                  commandsFactory.buildVersionedPutKeyValueCommand(e.getKey(), e.getValue(), e.getLifespan(), e.getMaxIdle(), e.getVersion(), flags)
                  : commandsFactory.buildPutKeyValueCommand(e.getKey(), e.getValue(), e.getLifespan(), e.getMaxIdle(), flags);

            boolean success = false;
            try {
View Full Code Here

            } else {
               // non-tx cache
               ctx = icc.createSingleKeyNonTxInvocationContext();
            }

            PutKeyValueCommand put = useVersionedPut ?
                  commandsFactory.buildVersionedPutKeyValueCommand(e.getKey(), e.getValue(), e.getLifespan(), e.getMaxIdle(), e.getVersion(), flags)
                  : commandsFactory.buildPutKeyValueCommand(e.getKey(), e.getValue(), e.getLifespan(), e.getMaxIdle(), flags);

            boolean success = false;
            try {
View Full Code Here

      return putInternal(key, value, lifespan, lifespanUnit, maxIdleTime, idleTimeUnit, explicitFlags, ctx);
   }

   private V putInternal(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit, EnumSet<Flag> explicitFlags, InvocationContext ctx) {
      assertKeyValueNotNull(key, value);
      PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime), explicitFlags);
      return (V) executeCommandAndCommitIfNeeded(ctx, command);
   }
View Full Code Here

   }

   private V putIfAbsentInternal(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit idleTimeUnit, EnumSet<Flag> explicitFlags, InvocationContext ctx) {
      assertKeyValueNotNull(key, value);
      // putForExternalRead calls only here, so only check here
      PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(key, value, lifespanUnit.toMillis(lifespan), idleTimeUnit.toMillis(maxIdleTime), explicitFlags);
      command.setPutIfAbsent(true);
      return (V) executeCommandAndCommitIfNeeded(ctx, command);
   }
View Full Code Here

               if (trace) log.tracef("Caching remotely retrieved entry for key %s in L1", key);
               // This should be fail-safe
               try {
                  long l1Lifespan = cacheConfiguration.clustering().l1().lifespan();
                  long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan);
                  PutKeyValueCommand put = cf.buildPutKeyValueCommand(ice.getKey(), ice.getValue(), lifespan, -1, command.getFlags());
                  lockAndWrap(ctx, key, ice, command);
                  invokeNextInterceptor(ctx, put);
               } catch (Exception e) {
                  // Couldn't store in L1 for some reason.  But don't fail the transaction!
                  log.infof("Unable to store entry %s in L1 cache", key);
View Full Code Here

TOP

Related Classes of org.infinispan.commands.write.PutKeyValueCommand

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.