Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.ConfigurationBuilder


          throw new CacheException("Unable to start region factory", t);
      }
   }

   private void definePendingPutsCache() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      // A local, lightweight cache for pending puts, which is
      // non-transactional and has aggressive expiration settings.
      // Locking is still required since the putFromLoad validator
      // code uses conditional operations (i.e. putIfAbsent).
      builder.clustering().cacheMode(CacheMode.LOCAL)
         .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL)
         .expiration().maxIdle(TimeUnit.SECONDS.toMillis(60))
         .storeAsBinary().enabled(false)
         .locking().isolationLevel(IsolationLevel.READ_COMMITTED)
         .jmxStatistics().disable();

      manager.defineConfiguration(PENDING_PUTS_CACHE_NAME, builder.build());
   }
View Full Code Here


            // 3. Build default configuration
            holder.getDefaultConfigurationBuilder().read(manager.getDefaultCacheConfiguration());

            // 4. Build all defined caches
            for (String cacheName : manager.getCacheNames()){
               ConfigurationBuilder builder = holder.newConfigurationBuilder(cacheName);
               builder.read(manager.getCacheConfiguration(cacheName));
            }

            // 5. Discard existing cache manager and create a brand new one
            manager.stop();
            manager = new DefaultCacheManager(holder, false);
View Full Code Here

    return globalConfiguration ;
  }
 
  private Configuration initConfiguration() {
   
    ConfigurationBuilder builder = new ConfigurationBuilder();
   
    ClusteringConfigurationBuilder clusteringConfigurationBuilder = builder.clustering();
   
    clusteringConfigurationBuilder = clusteringConfigurationBuilder.cacheMode(CacheMode.DIST_SYNC);
   
    HashConfigurationBuilder hashConfigurationBuilder = clusteringConfigurationBuilder.hash();
   
View Full Code Here

               .clusteredDefault() // Builds a default clustered configuration
               .transport().addProperty("configurationFile", "jgroups-udp.xml") //provide a specific JGroups configuration
               .globalJmxStatistics().allowDuplicateDomains(true).enable()  //This method enables the jmx statistics of
                     // the global configuration and allows for duplicate JMX domains
               .build()// Builds the GlobalConfiguration object
         Configuration loc = new ConfigurationBuilder()
               .jmxStatistics().enable()  //Enable JMX statistics
               .clustering().cacheMode(CacheMode.DIST_SYNC//Set Cache mode to DISTRIBUTED with SYNCHRONOUS replication
               .hash().numOwners(2) //Keeps two copies of each key/value pair
               .expiration().lifespan(ENTRY_LIFESPAN) //Set expiration - cache entries expire after some time (given by
                     // the lifespan parameter) and are removed from the cache (cluster-wide).
View Full Code Here

  public static void main(String[] args) throws IOException {

    EmbeddedCacheManager manager = new DefaultCacheManager();
//    Cache defaultCache = manager.getCache();
   
    Configuration c = new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).build();
   
    String newCacheName = "repl";
    manager.defineConfiguration(newCacheName, c);
    Cache<String, String> cache = manager.getCache(newCacheName);
  }
View Full Code Here

        // override the named cache configuration defined in the configuration file to
        // inject the platform TransactionManager
        for (String cacheName : tmpCacheManager.getCacheNames() ) {
          Configuration originalCfg = tmpCacheManager.getCacheConfiguration( cacheName );
          Configuration newCfg = new ConfigurationBuilder()
            .read( originalCfg )
              .transaction()
                .transactionManagerLookup( transactionManagerLookupDelegator )
            .build();
          cacheManager.defineConfiguration( cacheName, newCfg );
View Full Code Here

*/
public class ConfigCacheAPI {

  public static void main(String[] args) {

    Configuration configuration = new ConfigurationBuilder().clustering().cacheMode(CacheMode.LOCAL).build();
    DefaultCacheManager cacheManager = new DefaultCacheManager();
    String newCacheName = "repl";
    cacheManager.defineConfiguration(newCacheName, configuration);
    Cache<String, String> cache = cacheManager.getCache(newCacheName);
    AdvancedCache advancedCache = cache.getAdvancedCache();
View Full Code Here

    return new DefaultCacheManager("infinispan-replication.xml");
  }

  protected EmbeddedCacheManager initCacheManager() throws IOException {
    return new DefaultCacheManager(GlobalConfigurationBuilder.defaultClusteredBuilder().transport().addProperty("configurationFile", "jgroups.xml").build(),
                     new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).build());
  }
View Full Code Here

    return new DefaultCacheManager("infinispan-distribution.xml");
  }
 
  protected EmbeddedCacheManager initCacheManager() throws IOException {
    return new DefaultCacheManager( GlobalConfigurationBuilder.defaultClusteredBuilder().transport().addProperty("configurationFile", "jgroups.xml").build(),
                                new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(2).build());
  }
View Full Code Here

                 .clusteredDefault() // Builds a default clustered configuration
                 .transport().addProperty("configurationFile", "jgroups-udp.xml") //provide a specific JGroups configuration
                 .globalJmxStatistics().allowDuplicateDomains(true).enable()  //This method enables the jmx statistics of
                       // the global configuration and allows for duplicate JMX domains
                 .build()// Builds the GlobalConfiguration object
           Configuration loc = new ConfigurationBuilder()
                 .jmxStatistics().enable()  //Enable JMX statistics
                 .clustering().cacheMode(CacheMode.DIST_SYNC//Set Cache mode to DISTRIBUTED with SYNCHRONOUS replication
                 .hash().numOwners(2) //Keeps two copies of each key/value pair
                 .expiration().lifespan(ENTRY_LIFESPAN) //Set expiration - cache entries expire after some time (given by
                       // the lifespan parameter) and are removed from the cache (cluster-wide).
View Full Code Here

TOP

Related Classes of org.infinispan.configuration.cache.ConfigurationBuilder

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.