JBoss Community Archive (Read Only)

Infinispan 6.0

Configuration changes from 5.0 to 5.1

If you use XML to configure Infinispan, you shouldn't notice any change, except a much faster startup, courtesy of the Stax based parser. However, if you use programmatic configuration, read on for the important differences.

Configuration is now packaged in org.infinispan.configuration, and you must use a builder style:

Configuration c1 = new ConfigurationBuilder()  
   // Adjust any configuration defaults you want  
   .clustering()  
      .l1()  
         .disable()  
      .mode(DIST_SYNC)  
      .hash()  
         .numOwners(5)  
   .build();  

The old bean style configuration is now deprecated and will be removed in a later version.

Configuration properties which can be safely changed at runtime are mutable, and all others are immutable.

To copy a configuration, use the read() method on the builder, for example:

Configuration c2 = new ConfigurationBuilder()  
   // Read in C1 to provide defaults  
   .read(c1)  
   .clustering()  
      .l1()  
         .enable()  
   // This cache is DIST_SYNC, will have 5 owners, with L1 cache enabled  
   .build();  

This completely replaces the old system of defining a set of overrides on bean properties. Note that this means the behaviour of Infinispan configuration is somewhat different when used programmatically. Whilst before, you could define a default configuration, and any overrides would be applied on top of your defaults when defined, now you must explicitly read in your defaults to the builder. This allows for much greater flexibility in your code (you can have a as many "default" configurations as you want), and makes your code more explicit and type safe (finding references works).

The schema is unchanged from before. Infinispan 4.0 configurations are currently not being parsed. To upgrade, just change the schema definition from:

<infinispan  
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
     xsi:schemaLocation="urn:infinispan:config:4.1 http://www.infinispan.org/schemas/infinispan-config-4.1.xsd"  
     xmlns="urn:infinispan:config:4.1">  

to

<infinispan  
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
     xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"  
     xmlns="urn:infinispan:config:5.1">  

The schema documentation has changed format, as it is now produced using the standard tool xsddoc. This should be a significant improvement, as better navigation is offered. Some elements and attributes are missing docs right now, we are working on adding this. As an added benefit, your IDE should now show documentation when an xsd referenced (as above)

We are in the process of adding in support for this configuration style for modules (such as cache stores). In the meantime, please use the old configuration or XML if you require support for cache store module configuration.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 09:40:33 UTC, last content change 2012-01-23 16:49:19 UTC.