Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.ConfigurationBuilder


            GlobalConfiguration glob = new GlobalConfigurationBuilder()
                .nonClusteredDefault() //Helper method that gets you a default constructed GlobalConfiguration, preconfigured for use in LOCAL mode
                .globalJmxStatistics().enable() //This method allows enables the jmx statistics of the global configuration.
                .jmxDomain("org.infinispan.demo.carmart.tx"//prevent collision with non-transactional carmart
                .build(); //Builds  the GlobalConfiguration object
            Configuration loc = new ConfigurationBuilder()
                .jmxStatistics().enable() //Enable JMX statistics
                .clustering().cacheMode(CacheMode.LOCAL) //Set Cache mode to LOCAL - Data is not replicated.
                .transaction().transactionMode(TransactionMode.TRANSACTIONAL).autoCommit(false) //Enable Transactional mode with autocommit false
                .lockingMode(LockingMode.OPTIMISTIC).transactionManagerLookup(new GenericTransactionManagerLookup()) //uses GenericTransactionManagerLookup - This is a lookup class that locate transaction managers in the most  popular Java EE application servers. If no transaction manager can be found, it defaults on the dummy transaction manager.
                .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) //Sets the isolation level of locking
View Full Code Here


  Cache<Object, Object> cache;

  @Before
  public void setup() {
    EmbeddedCacheManager manager = new DefaultCacheManager();
    manager.defineConfiguration("custom-cache", new ConfigurationBuilder()
        .eviction().strategy(EvictionStrategy.LIRS).maxEntries(10)
        .build());
    cache = manager.getCache("custom-cache");
  }
View Full Code Here

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

public class GlobalConfigurationBuilderTest {

  public static void main(String[] args) {
   
    ConfigurationBuilder builder = new ConfigurationBuilder();
   
    ClusteringConfigurationBuilder clusteringConfigurationBuilder = builder.clustering();
   
    clusteringConfigurationBuilder = clusteringConfigurationBuilder.cacheMode(CacheMode.DIST_SYNC);
   
    HashConfigurationBuilder hashConfigurationBuilder = clusteringConfigurationBuilder.hash();
   
View Full Code Here

    System.out.println("Stu End, spent " + (System.currentTimeMillis() - start) + " miliseconds");
  }

  private void stuConfigurationBuilder() {
   
    ConfigurationBuilder builder = new ConfigurationBuilder();
    ClusteringConfigurationBuilder clusterBuilder = builder.clustering().cacheMode(CacheMode.REPL_SYNC);
    Configuration config = clusterBuilder.build();
  }
View Full Code Here

  public static void main(String[] args) {
   
    EmbeddedCacheManager manager = new DefaultCacheManager();
   
    manager.defineConfiguration("named-cache", new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LIRS).maxEntries(10).build());
   
    Cache<Object, Object> cache = manager.getCache("named-cache");
   
    for (int i = 0; i < 10; i++) {
      cache.put("key-" + i, new User(i, "Kylin Soong", "IT"));
View Full Code Here

    return CACHE_NAME;
  }

  protected EmbeddedCacheManager createCacheManager() 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

    super();
  }
 
  protected EmbeddedCacheManager createCacheManager() 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

            GlobalConfiguration glob = new GlobalConfigurationBuilder()
                .nonClusteredDefault() //Helper method that gets you a default constructed GlobalConfiguration, preconfigured for use in LOCAL mode
                .globalJmxStatistics().enable() //This method allows enables the jmx statistics of the global configuration.
                .jmxDomain("org.infinispan.carmart.tx"//prevent collision with non-transactional carmart
                .build(); //Builds  the GlobalConfiguration object
            Configuration loc = new ConfigurationBuilder()
                .jmxStatistics().enable() //Enable JMX statistics
                .clustering().cacheMode(CacheMode.LOCAL) //Set Cache mode to LOCAL - Data is not replicated.
                .transaction().transactionMode(TransactionMode.TRANSACTIONAL).autoCommit(false) //Enable Transactional mode with autocommit false
                .lockingMode(LockingMode.OPTIMISTIC).transactionManagerLookup(new GenericTransactionManagerLookup()) //uses GenericTransactionManagerLookup - This is a lookup class that locate transaction managers in the most  popular Java EE application servers. If no transaction manager can be found, it defaults on the dummy transaction manager.
                .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) //Sets the isolation level of locking
View Full Code Here

            GlobalConfiguration glob = new GlobalConfigurationBuilder()
                .nonClusteredDefault() //Helper method that gets you a default constructed GlobalConfiguration, preconfigured for use in LOCAL mode
                .globalJmxStatistics().enable() //This method allows enables the jmx statistics of the global configuration.
                .jmxDomain("org.infinispan.carmart.tx") //prevent collision with non-transactional carmart
                .build(); //Builds  the GlobalConfiguration object
            Configuration loc = new ConfigurationBuilder()
                .jmxStatistics().enable() //Enable JMX statistics
                .clustering().cacheMode(CacheMode.LOCAL) //Set Cache mode to LOCAL - Data is not replicated
                .transaction().transactionMode(TransactionMode.TRANSACTIONAL).autoCommit(false) //Enable Transactional mode with autocommit false
                .lockingMode(LockingMode.OPTIMISTIC).transactionManagerLookup(new JBossStandaloneJTAManagerLookup()) //uses JBossStandaloneJTAManagerLookup - If you're running Infinispan in a standalone environment, this should be your default choice for transaction manager. It's a fully fledged transaction manager based on JBoss Transactions which overcomes all the deficiencies of the dummy transaction manager.
                .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) //Sets the isolation level of locking
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.