| Sign In/My Account | View Cart |
JBoss Cache as a POJO Cache
Pages: 1, 2, 3, 4, 5, 6
The default plain cache module in JBoss Cache is called TreeCache. You can configure it either programmatically or through an external XML file. Here are the features that you can configure:
LRUEvictionPolicy.The POJO cache module in JBoss Cache is called TreeCacheAop. In order to use the POJO cache, you have to "prepare" the objects (this process is also known as object instrumentation) before they are cached. This is needed so that the system can intercept the POJO operations. The object instrumentation process is performed by the JBoss AOP library. JBoss AOP allows you to specify the to-be-instrumented classes via an XML file or annotations. Currently, we support only JDK-1.4-style annotation (a specific feature of JBoss AOP). JDK 5.0 annotation support is coming in the next release and it will make the instrumentation process nearly transparent!
TreeCacheAop is a subclass of TreeCache, so it uses the same XML file for configuration and provides the same caching functionality as its superclass counterpart. The JBoss POJO Cache also has a POJO-based eviction policy.
In the rest of the article, we will use a "sensor network supervising system" example to illustrate the capability of JBoss POJO Cache in providing instantaneous fine-grained state replication and automatic preservation of state object relationship.
In the different stations along a high-speed railway, there are thousands of sensors that need to be monitored and supervised. Examples of such instruments include temperature, wind, and rain sensors that are critical to the successful operation of a high-speed train. If a particular sensor is malfunctioning, the manager computer in the supervising system should alert the administrator and shut down the unit and/or schedule it for maintenance.
Since the operation is mission-critical, the supervising system has to be highly available, meaning that whenever one sensor manager computer in the system goes down, the administrator should be able to seamlessly switch over to another one to perform supervision and active management. Hence, all manager computers must replicate the same sensor network state information at real time. Note that the characteristics of this kind of system--i.e., the requirement of high-availability and the existence of thousands (or even larger numbers) of elements--are also commonplace elsewhere in modern-day network management. Figure 2 illustrates the overview of such system that includes a clustering capability.

Figure 2. Overview of the sensor supervising system
Because of the hierarchical nature of the sensor network, a complicated domain object graph will typically be required to model the sensor network on the manager side. When the domain object states are not replicated (or persisted), management of object relationships (e.g., adding nodes and traversing the graph nodes) is provided by the JVM itself, and thus is transparent to the end user. However, because the Java serialization process does not recognize the object relationship, this seemingly simplistic object-graph relationship will break down when the states are either replicated or persisted. As a result, it renders a simple failover of the manager side components difficult to achieve.