Package org.infinispan.loaders.modifications

Examples of org.infinispan.loaders.modifications.Modification


                     return;
                  }
                  if (trace)
                     log.tracef("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


      public void run() {
         LogFactory.pushNDC(cacheName, trace);
         try {
            while (true) {
               try {
                  Modification take = changesDeque.take();
                  if (take == QUIT_SIGNAL) {
                     lastAsyncProcessorShutsDownExecutor = true;
                     ensureMoreWorkIsHandled();
                     return;
                  }
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

   }

   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());
View Full Code Here

      try {
         if (stopped.get()) {
            throw new CacheException("AsyncStore stopped; no longer accepting more entries.");
         }
         if (trace) log.trace("Enqueuing modification {0}", mod);
         Modification prev = null;
         int c = -1;
         boolean unlock = false;
         try {
            acquireLock(read);
            unlock = true;
View Full Code Here

            // have been enqueued by a user thread.
            for (Object key : swap.keySet()) {
               boolean acquired = lockContainer.acquireLock(key, 0, TimeUnit.NANOSECONDS);
               if (trace) log.trace("Lock for key {0} was acquired={1}", key, acquired);
               if (!acquired) {
                  Modification prev = swap.remove(key);
                  state.put(key, prev);
               } else {
                  lockedKeys.add(key);
               }
            }
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.tracef("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

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.