1 2 Previous Next 18 Replies Latest reply: Feb 24, 2011 1:41 PM by Galder Zamarreño RSS

Configuration API changes in 5.0

Vladimir Blagojevic Master

As some of you have asked for more fluent API in Infinispan configuration I have completed a proposal for a review. We are not going to remove current setters and getters, setters will be deprecated in 5.0 and removed in Infinispan 6.0 leaving only fluent API for setter. I have myself been rather suprprised how much easier is it to use fluent API than the old flat API approach. Configuration classes are organized into logical units reflecting configuration structure described in http://docs.jboss.org/infinispan/4.2/apidocs/config.html

 

Here is a sample setting GlobalConfiguration:

 

 

GlobalConfiguration gc = new GlobalConfiguration();
GlobalJmxStatisticsConfig jmxStatistics = gc.configureGlobalJmxStatistics();
jmxStatistics.setAllowDuplicateDomains(true).setEnabled(true);

TransportConfig transport = gc.configureTransport();
transport.setClusterName("blah").setMachineId("id").setRackId("rack").setStrictPeerToPeer(true);

ExecutorFactoryConfig<ExecutorFactory> asyncTransportExecutor = gc.configureAsyncTransportExecutor();
asyncTransportExecutor.setClass(DefaultExecutorFactory.class).addProperty("blah", "blah");

 

And Configuration:

 

Configuration c = new Configuration();
LockingConfig locking = c.configureLocking();
locking.setIsolationLevel(IsolationLevel.REPEATABLE_READ).setLockAcquisitionTimeout(1000L);

ExpirationConfig expiration = c.configureExpiration();
expiration.setLifespan(1000L).setMaxIdle(1000L);

EvictionConfig eviction = c.configureEviction();
eviction.setMaxEntries(1000).setStrategy(EvictionStrategy.LRU);

ClusteringConfig clustering = c.configureClustering();
clustering.configureAsync().setAsyncMarshalling(true).setReplQueueInterval(1000L);
clustering.configureHash().setRehashEnabled(true).setRehashRpcTimeout(1000L);
clustering.configureL1().setEnabled(true).setOnRehash(true).setLifespan(1000L);
clustering.configureStateRetrieval().setAlwaysProvideInMemoryState(true).setInitialRetryWaitTime(1000L);
clustering.setMode(CacheMode.DIST_SYNC);

LoadersConfig loaders = c.configureLoaders();
loaders.setPassivation(true).setPreload(true).setShared(false);
FileCacheStoreConfig fcsc = new FileCacheStoreConfig();
fcsc.configureAsyncStore().setEnabled(true).setFlushLockTimeout(1000L);
fcsc.configureSingletonStore().setPushStateTimeout(1000L).setSingletonStoreEnabled(true);
loaders.addCacheLoaderConfig(fcsc);

 

 

I have still some final details to complete, mark deprecated methods, write javadoc before I integrate these changes in 5.0 branch. In the meantime you can review a complete proposal here https://github.com/vblagoje/infinispan/commit/d6aff87

 

Related JIRA is https://issues.jboss.org/browse/ISPN-911

 

Regards,

Vladimir

1 2 Previous Next