Package org.infinispan.loaders.modifications

Examples of org.infinispan.loaders.modifications.Store


      transactions = new ConcurrentHashMap<GlobalTransaction, List<? extends Modification>>(64, 0.75f, concurrencyLevel);
   }

   @Override
   public void store(InternalCacheEntry ed) {
      enqueue(new Store(ed));
   }
View Full Code Here


      private void handle(Modification mod, boolean nested) {
         boolean asyncProcessorNeeded = false;
         switch (mod.getType()) {
            case STORE:
               Store store = (Store) mod;
               stateMapLock.lock();
               state.put(store.getStoredEntry().getKey(), store);
               stateMapLock.unlock();
               asyncProcessorNeeded = true;
               break;
            case REMOVE:
               Remove remove = (Remove) mod;
View Full Code Here

      transactions = new ConcurrentHashMap<GlobalTransaction, List<? extends Modification>>(64, 0.75f, concurrencyLevel);
   }

   @Override
   public void store(InternalCacheEntry ed) {
      enqueue(new Store(ed));
   }
View Full Code Here

      private void handle(Modification mod, boolean nested) {
         boolean asyncProcessorNeeded = false;
         switch (mod.getType()) {
            case STORE:
               Store store = (Store) mod;
               stateMapLock.lock();
               state.put(store.getStoredEntry().getKey(), store);
               stateMapLock.unlock();
               asyncProcessorNeeded = true;
               break;
            case REMOVE:
               Remove remove = (Remove) mod;
View Full Code Here

      }

      private Object visitSingleStore(InvocationContext ctx, Object key) throws Throwable {
         if (!skipKey(key)) {
            if (generateStatistics) putCount++;
            modifications.add(new Store(getStoredEntry(key, ctx)));
            affectedKeys.add(key);
         }
         return null;
      }
View Full Code Here

      public void doWork() throws Exception {
         for (Modification modification : mods)
            switch (modification.getType()) {
               case STORE:
                  Store s = (Store) modification;
                  store(s.getStoredEntry());
                  break;
               case CLEAR:
                  cacheMap.clear();
                  break;
               case REMOVE:
View Full Code Here

        runner.run(isA(TransactionWorker.class));
        expectLastCall().andThrow(new RuntimeExceptionWrapper(ex));
        replayAll();
        cs.start();
        try {
            cs.applyModifications(Collections.singletonList(new Store(InternalEntryFactory.create("k", "v"))));
            assert false : "should have gotten an exception";
        } catch (CacheLoaderException e) {
            assert ex.equals(e.getCause());
            verifyAll();
            return;
View Full Code Here

        replay(txn);
        cs.start();
        try {
            txn = currentTransaction.beginTransaction(null);
            GlobalTransaction t = new GlobalTransaction(false);
            cs.prepare(Collections.singletonList(new Store(InternalEntryFactory.create("k", "v"))), t, false);
            cs.commit(t);
            assert false : "should have gotten an exception";
        } catch (CacheLoaderException e) {
            assert ex.equals(e.getCause());
            verifyAll();
View Full Code Here

        expectLastCall().andThrow(new RuntimeExceptionWrapper(ex));
        replayAll();
        cs.start();
        try {
            GlobalTransaction tx = new GlobalTransaction(false);
            cs.prepare(Collections.singletonList(new Store(InternalEntryFactory.create("k", "v"))), tx, false);
            assert false : "should have gotten an exception";
        } catch (CacheLoaderException e) {
            assert ex.equals(e.getCause());
            verifyAll();
            return;
View Full Code Here

   }


   public void testOnePhaseCommit() throws CacheLoaderException {
      List<Modification> mods = new ArrayList<Modification>();
      mods.add(new Store(InternalEntryFactory.create("k1", "v1")));
      mods.add(new Store(InternalEntryFactory.create("k2", "v2")));
      mods.add(new Remove("k1"));
      Transaction tx = EasyMock.createNiceMock(Transaction.class);
      prepare(mods, tx, true);

      Set s = loadAll();

      assert load("k2").getValue().equals("v2");
      assert !cacheMap.containsKey("k1");

      cacheMap.clear();

      mods = new ArrayList<Modification>();
      mods.add(new Store(InternalEntryFactory.create("k1", "v1")));
      mods.add(new Store(InternalEntryFactory.create("k2", "v2")));
      mods.add(new Clear());
      mods.add(new Store(InternalEntryFactory.create("k3", "v3")));

      prepare(mods, tx, true);
      assert !cacheMap.containsKey("k1");
      assert !cacheMap.containsKey("k2");
      assert cacheMap.containsKey("k3");
View Full Code Here

TOP

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

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.