Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.ConfigurationBuilder.eviction()


public class LocalDeltaAwarePassivationTest extends LocalDeltaAwareEvictionTest {

   @Override
   protected void createCacheManagers() throws Throwable {
      ConfigurationBuilder configBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
      configBuilder.eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .loaders().passivation(true).addStore().cacheStore(new DummyInMemoryCacheStore());

      addClusterEnabledCacheManager(configBuilder);
   }
View Full Code Here


      protected final Cache<String, String> cache;
      protected final LockableCacheStore store;

      private static ConfigurationBuilder config(boolean passivation) {
         ConfigurationBuilder config = new ConfigurationBuilder();
         config.eviction().maxEntries(1).loaders().passivation(passivation).addStore()
               .cacheStore(new LockableCacheStore()).async().enable();
         return config;
      }

      OneEntryCacheManagerCallable(boolean passivation) {
View Full Code Here

   }

   private ConfigurationBuilder asyncStoreWithEvictionBuilder() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      // Emulate eviction with direct data container eviction
      builder.eviction().strategy(EvictionStrategy.LRU).maxEntries(1)
            .loaders()
            .addStore(DummyInMemoryCacheStoreConfigurationBuilder.class)
            .async().enabled(true);
      return builder;
   }
View Full Code Here

   final CountDownLatch activationWait = new CountDownLatch(1);

   @Override
   protected EmbeddedCacheManager createCacheManager() throws Exception {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.eviction().strategy(EvictionStrategy.LRU).maxEntries(1)
         .jmxStatistics().enable()
         .loaders()
            .passivation(true)
            .addLoader(DummyInMemoryCacheStoreConfigurationBuilder.class);
View Full Code Here

   private static final boolean USE_ASYNC_STORE = true;

   private static ConfigurationBuilder config(boolean passivation, int threads) {
      ConfigurationBuilder config = new ConfigurationBuilder();
      config.expiration().wakeUpInterval(100);
      config.eviction().maxEntries(1).strategy(EvictionStrategy.LRU);
      CacheStoreConfigurationBuilder store = config.loaders().passivation(passivation).addStore().cacheStore(new LockableCacheStore());
      if (USE_ASYNC_STORE)
         store.async().enable().threadPoolSize(threads);
      return config;
   }
View Full Code Here

      });
   }

   public void testLIRS() throws Exception {
      ConfigurationBuilder config = config(false, 1);
      config.eviction().strategy(EvictionStrategy.LIRS).maxEntries(1);
      TestingUtil.withCacheManager(new CacheCallable(config) {
         @Override
         public void call() {
            cache.put("k1", "v1");
            cache.put("k2", "v2");
View Full Code Here

      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true);

      //Verification for ISPN-2386 - the following exception should not appear:
      //java.lang.ClassCastException: org.infinispan.marshall.MarshalledValue cannot be cast to org.infinispan.distexec.mapreduce.Book

      builder.eviction().maxEntries(1).strategy(EvictionStrategy.LRU);
      builder.loaders().passivation(true).addStore().cacheStore(new DummyInMemoryCacheStore(getClass().getSimpleName()));
      builder.storeAsBinary().enable();

      createClusteredCaches(4, "bookSearch", builder);
   }
View Full Code Here

   @Test(expectedExceptions = IllegalArgumentException.class,
         expectedExceptionsMessageRegExp = "ISPN(\\d)*: Lucene Directory for index '" + INDEX_NAME +
               "' can not use Metadata Cache '" + CACHE_NAME + "': eviction enabled on the Cache configuration!")
   public void testFailOnEviction() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.eviction().strategy(EvictionStrategy.LIRS).maxEntries(1);
      doConfigurationTest(builder);
   }

   @Test(expectedExceptions = IllegalArgumentException.class,
         expectedExceptionsMessageRegExp = "ISPN(\\d)*: Lucene Directory for index '" + INDEX_NAME +
View Full Code Here

   }

   public void testSuccessfullConfiguration() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).preload(true);
      builder.eviction().strategy(EvictionStrategy.NONE).maxEntries(-1);
      doConfigurationTest(builder);
   }

   private void doConfigurationTest(ConfigurationBuilder configuration) {
      EmbeddedCacheManager cacheManager = null;
View Full Code Here

      protected final Cache<String, String> cache;
      protected final LockableCacheStore store;

      private static ConfigurationBuilder config(boolean passivation) {
         ConfigurationBuilder config = new ConfigurationBuilder();
         config.eviction().maxEntries(1).loaders().passivation(passivation).addStore()
               .cacheStore(new LockableCacheStore()).async().enable();
         return config;
      }

      OneEntryCacheManagerCallable(boolean passivation) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.