Package org.infinispan.loaders.modifications

Examples of org.infinispan.loaders.modifications.Modification


      return super.load(key);
   }

   @Override
   public boolean containsKey(Object key) throws CacheLoaderException {
      Modification mod = state.get(key);
      if (mod != null)
         return mod.getType() == Modification.Type.STORE;

      return super.containsKey(key);
   }
View Full Code Here


       * @return the Modification for the specified key, or <code>CLEAR</code> if the state was
       *         cleared, or <code>null</code> if the key is not in the state map
       */
      Modification get(Object key) {
         for (State state = this; state != null; state = state.next) {
            Modification mod = state.modifications.get(key);
            if (mod != null)
               return mod;
            else if (state.clear)
               return CLEAR;
         }
View Full Code Here

      }
   }

   @Override
   public InternalCacheEntry load(Object key) throws CacheLoaderException {
      Modification mod = state.get(key);
      if (mod != null) {
         switch (mod.getType()) {
            case REMOVE:
            case CLEAR:
               return null;
            case STORE:
               InternalCacheEntry ice = ((Store) mod).getStoredEntry();
View Full Code Here

      return super.load(key);
   }

   @Override
   public boolean containsKey(Object key) throws CacheLoaderException {
      Modification mod = state.get(key);
      if (mod != null)
         return mod.getType() == Modification.Type.STORE;

      return super.containsKey(key);
   }
View Full Code Here

       * @return the Modification for the specified key, or <code>CLEAR</code> if the state was
       *         cleared, or <code>null</code> if the key is not in the state map
       */
      Modification get(Object key) {
         for (State state = this; state != null; state = state.next) {
            Modification mod = state.modifications.get(key);
            if (mod != null)
               return mod;
            else if (state.clear)
               return CLEAR;
         }
View Full Code Here

      private void run0() throws InterruptedException {
         log.trace("Checking for modifications");
         int i = queue.drainTo(mods, asyncStoreConfig.getBatchSize());
         if (i == 0) {
            Modification m = queue.take();
            mods.add(m);
         }

         if (trace) log.trace("Calling put(List) with {0} modifications", mods.size());
         put(mods);
View Full Code Here

   }

   protected void applyModificationsSync(ConcurrentMap<Object, Modification> mods) throws CacheLoaderException {
      Set<Map.Entry<Object, Modification>> entries = mods.entrySet();
      for (Map.Entry<Object, Modification> entry : entries) {
         Modification mod = entry.getValue();
         switch (mod.getType()) {
            case STORE:
               super.store(((Store) mod).getStoredEntry());
               break;
            case REMOVE:
               super.remove(entry.getKey());
               break;
            default:
               throw new IllegalArgumentException("Unexpected modification type " + mod.getType());
         }
      }
   }
View Full Code Here

                     return;
                  }
                  if (trace)
                     log.trace("Lock for key %s was acquired=%s", key, acquired);
                  if (!acquired) {
                     Modification prev = swap.remove(key);
                     Modification didPut = state.putIfAbsent(key, prev); // don't overwrite more recently put work
                     if (didPut == null) {
                        // otherwise a new job is being spawned by the arbiter, so no need to create
                        // a new worker
                        runAgainAfterWaiting = true;
                     }
View Full Code Here

      @Override
      public void run() {
         while (true) {
            try {
               Modification take = changesDeque.take();
               if (take == QUIT_SIGNAL) {
                  lastAsyncProcessorShutsDownExecutor = true;
                  ensureMoreWorkIsHandled();
                  return;
               }
View Full Code Here

   }

   protected void applyModificationsSync(ConcurrentMap<Object, Modification> mods) throws CacheLoaderException {
      Set<Map.Entry<Object, Modification>> entries = mods.entrySet();
      for (Map.Entry<Object, Modification> entry : entries) {
         Modification mod = entry.getValue();
         switch (mod.getType()) {
            case STORE:
               super.store(((Store) mod).getStoredEntry());
               break;
            case REMOVE:
               super.remove(entry.getKey());
               break;
            default:
               throw new IllegalArgumentException("Unexpected modification type " + mod.getType());
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.loaders.modifications.Modification

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.