[jboss-user] [JBoss Cache] Document updated/added: "JBossCacheHabanero"

Manik Surtani do-not-reply at jboss.com
Mon Feb 22 10:36:05 EST 2010

User development,

The document "JBossCacheHabanero", was updated Feb 22, 2010
by Manik Surtani.

To view the document, visit:

h2. JBoss Cache 2.0.0 +"Habanero"+ designs
h3.  JDK baseline?
There is a http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84037 around whether Habanero should use Java 5 as a baseline, and http://community.jboss.org/docs/DOC-10738 as a means to providing Java 1.4.x compatible builds.  See http://community.jboss.org/docs/DOC-10263 for more details.
Habanero will use Java 5 as it's baseline and make full use of Java 5 language and API features, particularly in place of Doug Lea's concurrent.jar, albeit with some caveats listed on the JBossRetroPitfalls page.  
h3.  JGroups dependency
In addition, Habanero will ship with and depend on JGroups 2.5, which too is baselined on Java 5.
h3.  JSR-107 JCache compliant interfaces
While sticking to a JSR is probably a good thing, for several reasons Habanero will not be JSR-107 compliant:
* JSR-107 is incomplete and is still in flux
* JSR-107 defines a flat, map-like cache.  JBoss Cache uses a tree-structured cache.
As such, one of the goals of Habanero is to glean good design ideas off JSR-107 (such as cache factories, interfaces and listeners), follow close naming conventions, and perhaps once the JSR is complete, provide an interface to JBoss Cache that is JSR-107 compliant.
See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82121 on this subject.
h3.  Preliminary interfaces
Other discussions on the http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82121 and http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82117 have also been ongoing.  Here's one on the http://www.jboss.com/index.html?module=bb&op=viewtopic&t=87333.
In it's current state, we have a concept as follows:
* This raises the Node object as a top-level construct in the cache.
* The cache itself is a wrapper around the root node, providing some additional cache-wide operations.
* All operations performed on the node are relative to the node.
* Cache and Node interfaces are minimalist, providing basic cache functionality.
* SPI interfaces are available to both cache and node, that allow access to some internals.
** Intended to be used by plugin authors and people extending JBoss Cache 
** Not indended for use by applications directly.
* New construction mechanism and lifecycle management by the CacheFactory
Please see http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/Habanero/api/org/jboss/cache/Cache.html, published here.  Lots of javadoc comments detail the operation of each method.
h3.  Using the new interfaces
Simple usage example:

   // create a factory
   CacheFactory factory = new CacheFactoryImpl();

   // create and start the cache
   Cache c = factory.createCache("META-INF/replSync-service.xml"); 

   // add a child node, and put some data in it
   c.addChild("/a/b/c").put("key", "value");

   // retrieve the child node from the cache
   Node abc = c.getChild("/a/b/c");

   // create a new child 
   Node n123 = c.addChild("/1/2/3");

   // move nodes around
   abc.getFqn(); // expecting "/1/2/3/a/b/c"

   // add a new child, relative to current node
   n123.addChild("/4/5/6").put("key2", "value2");

   c.getChild("/1/2/3/4/5/6").get("key2"); // should equal value2


h3.  Implementing Habanero
For Habanero, these new interfaces and APIs will be implemented as simple wrappers around the existing, proven TreeCache.  In a later release, possibly JBoss Cache 2.1.0, the internals of how the cache and tree is organised may change, but the interfaces and API defined here will be adhered to.


More information about the jboss-user mailing list