Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.Configuration


    Assert.assertNotNull( "This CacheManager is configured for clustering but the Transport was not found", cacheManager.getTransport() );
  }

  public static void verifyConfiguredAsClustered(final Cache<?, ?> cache) {
    verifyConfiguredAsClustered( cache.getCacheManager() );
    final Configuration cacheConfiguration = cache.getCacheConfiguration();
    Assert.assertTrue( "This Cache is managed by a clustered CacheManager, but the Cache is having clustering disabled!", cacheConfiguration.clustering().cacheMode().isClustered() );
  }
View Full Code Here


   
    HashConfigurationBuilder hashConfigurationBuilder = clusteringConfigurationBuilder.hash();
   
    hashConfigurationBuilder = hashConfigurationBuilder.numOwners(2);
   
    Configuration configuration = hashConfigurationBuilder.build();
   
    return configuration ;
  }
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

        cacheManager = new DefaultCacheManager( globalConfiguration, false );

        // 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

                 .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

            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

   
    HashConfigurationBuilder hashConfigurationBuilder = clusteringConfigurationBuilder.hash();
   
    hashConfigurationBuilder = hashConfigurationBuilder.numOwners(2);
   
    Configuration configuration = hashConfigurationBuilder.build();
   
    return configuration ;
  }
View Full Code Here

   
    HashConfigurationBuilder hashConfigurationBuilder = clusteringConfigurationBuilder.hash();
   
    hashConfigurationBuilder = hashConfigurationBuilder.numOwners(2);
   
    Configuration configuration = hashConfigurationBuilder.build();
   
    System.out.println("DONE");
  }
View Full Code Here

TOP

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

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.