JBoss Cache

From Shrubbery

Jump to: navigation, search


Notes on using JBoss Cache.

Contents

[edit] Dependencies

When using JBoss Cache inside JBoss AS, the dependencies are:

In the {server home}/lib directory...

  • jboss-j2ee.jar - JTA API, etc.
  • jgroups.jar - JGroups clustering library. NOTE: This is necessary even if you are not clustering.
  • jboss.jar - JBoss invocation stuff.
  • jboss-serialization.jar - JBoss serialization stuff.

In the {jboss home}/lib directory...

  • jboss-system.jar - JBoss base classes.
  • jboss-jmx.jar - JMX stuff.
  • jboss-common.jar - Logging, etc.
  • commons-logging.jar - Logging.
  • concurrent.jar - Concurrency.

In the {jboss home}/client/lib directory...

  • trove.jar - More serialization stuff.

[edit] Using JBoss Cache inside JBoss AS

Since JBoss AS uses TreeCache to implement clustered JNDI, there isn't much overhead in using it because the libraries are already there.

[edit] Version Compatibility

  • JBoss 4.x uses JBoss Cache 1.4.x, and is not compatible with JBoss Cache 2.x.

[edit] Pre-defined Cache objects

Cache Descriptor file MBean Name
EJB3 Entity Cache

(Hibernate 2nd level cache)

{server-dir}/deploy/
ejb3-entity-cache-service.xml
jboss.cache:service=EJB3EntityTreeCache
EJB3 SFSB Cache {server-dir}/deploy/
ejb3-clustered-sfsbcache-service.xml
jboss.cache:service=EJB3SFSBClusteredCache

[edit] Defining an MBean

The simplest way to define a cache is to make an MBean. This is exactly how JBoss AS defines the EJB3 Entity Cache and the SFSB cache.

[edit] Looking up the TreeCache object

[edit] Testing with JTA Transactions

Use the 'dummy' transaction manager implementation, which is provided in the JBoss Cache jar. You will also need the JTA API, which is in jboss-j2ee.jar.

[edit] See Also

Personal tools