Package org.infinispan.persistence.manager

Examples of org.infinispan.persistence.manager.PersistenceManager


      ReplicationQueue queue = TestingUtil.extractComponent(cache, ReplicationQueue.class);
      if (queue != null) queue.reset();
   }

   public static void clearCacheLoader(Cache cache) {
      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache, PersistenceManager.class);
      persistenceManager.clearAllStores(BOTH);
   }
View Full Code Here


      }
      return old;
   }

   public static CacheLoader getCacheLoader(Cache cache) {
      PersistenceManager clm = extractComponent(cache, PersistenceManager.class);
      if (cache.getCacheConfiguration().persistence().usingStores()) {
         return TestingUtil.getFirstLoader(cache);
      } else {
         return null;
      }
View Full Code Here

      }
   }

   public static <K, V> void writeToAllStores(K key, V value, Cache<K, V> cache) {
      AdvancedCache<K, V> advCache = cache.getAdvancedCache();
      PersistenceManager pm = advCache.getComponentRegistry().getComponent(PersistenceManager.class);
      StreamingMarshaller marshaller = advCache.getComponentRegistry().getCacheMarshaller();
      pm.writeToAllStores(new MarshalledEntryImpl(key, value, null, marshaller), BOTH);
   }
View Full Code Here

      pm.writeToAllStores(new MarshalledEntryImpl(key, value, null, marshaller), BOTH);
   }

   public static <K, V> boolean deleteFromAllStores(K key, Cache<K, V> cache) {
      AdvancedCache<K, V> advCache = cache.getAdvancedCache();
      PersistenceManager pm = advCache.getComponentRegistry().getComponent(PersistenceManager.class);
      return pm.deleteFromAllStores(key, BOTH);
   }
View Full Code Here

      StateTransferManager stateTransferManager = mock(StateTransferManager.class);
      CacheNotifier cacheNotifier = mock(CacheNotifier.class);
      RpcManager rpcManager = mock(RpcManager.class);
      Transport transport = mock(Transport.class);
      CommandsFactory commandsFactory = mock(CommandsFactory.class);
      PersistenceManager persistenceManager = mock(PersistenceManager.class);
      DataContainer dataContainer = mock(DataContainer.class);
      TransactionTable transactionTable = mock(TransactionTable.class);
      StateTransferLock stateTransferLock = mock(StateTransferLock.class);
      InterceptorChain interceptorChain = mock(InterceptorChain.class);
      InvocationContextFactory icf = mock(InvocationContextFactory.class);
View Full Code Here

      originalValues.put(new MagicKey(cache1), "cache1");
      originalValues.put(new MagicKey(cache2), "cache2");

      cache0.putAll(originalValues);

      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache0, PersistenceManager.class);
      DummyInMemoryStore store = persistenceManager.getStores(DummyInMemoryStore.class).iterator().next();

      TestObjectStreamMarshaller sm = new TestObjectStreamMarshaller();
      PersistenceManager pm = null;
      try {
         MagicKey loaderKey = new MagicKey(cache2);
         String loaderValue = "loader-value";
         store.write(new MarshalledEntryImpl(loaderKey, loaderValue, null, sm));
         if (includeLoaderEntry) {
View Full Code Here

      final int NUM_READER_THREADS = 2;
      final int NUM_KEYS = 5;
      final int TEST_DURATION_SECONDS = 2;

      Cache<String, String> cache = cacheManager.getCache(CACHE_NAME);
      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache, PersistenceManager.class);
      final SingleFileStore store = persistenceManager.getStores(SingleFileStore.class).iterator().next();
      final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller();
      assertEquals(0, store.size());
     
      final List<String> keys = new ArrayList<String>(NUM_KEYS);
      for (int j = 0; j < NUM_KEYS; j++) {
View Full Code Here

      final int NUM_READER_THREADS = 2;
      final int NUM_KEYS = 5;
      final int TEST_DURATION_SECONDS = 2;

      Cache<String, String> cache = cacheManager.getCache(CACHE_NAME);
      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache, PersistenceManager.class);
      final SingleFileStore store = persistenceManager.getStores(SingleFileStore.class).iterator().next();
      final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller();
      assertEquals(0, store.size());

      final List<String> keys = new ArrayList<String>(NUM_KEYS);
      for (int j = 0; j < NUM_KEYS; j++) {
View Full Code Here

   public void testSpaceOptimization() throws ExecutionException, InterruptedException {
      final int NUM_KEYS = 100;
      final int TIMES = 10;

      Cache<String, String> cache = cacheManager.getCache(CACHE_NAME);
      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache, PersistenceManager.class);
      final SingleFileStore store = persistenceManager.getStores(SingleFileStore.class).iterator().next();
      final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller();
      assertEquals(0, store.size());

      long [] fileSizesWithoutPurge = new long [TIMES];
      long [] fileSizesWithPurge = new long [TIMES];
View Full Code Here

      final int NUM_READER_THREADS = 2;
      final int NUM_KEYS = 5;
      final int TEST_DURATION_SECONDS = 2;

      Cache<String, String> cache = cacheManager.getCache(CACHE_NAME);
      PersistenceManager persistenceManager = TestingUtil.extractComponent(cache, PersistenceManager.class);
      final SingleFileStore store = persistenceManager.getStores(SingleFileStore.class).iterator().next();
      final StreamingMarshaller marshaller = TestingUtil.extractComponentRegistry(cache).getCacheMarshaller();
      assertEquals(0, store.size());

      // Write a few entries into the cache
      final List<String> keys = new ArrayList<String>(NUM_KEYS);
View Full Code Here

TOP

Related Classes of org.infinispan.persistence.manager.PersistenceManager

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.