Please note the bold text lines. Basically, we do a POJO operation setState first on manager #1 and then print out the propagation tree from the second manager to verify that the state has been updated, and vice versa. It is worthwhile to repeat that, although not shown in the output for the replication layer traffic, each setState() operation will only trigger a fine-grained field-level replication. In addition, if the call is under a transaction context, then the update will be batched; i.e., replicated only when it is ready to commit. Finally, notice that we have the capability to add a new sensor into the network on the fly. A traditional system would have required some sort of restart mechanism.

If you are interested in running this example yourself, you can download JBoss Cache release 1.2.4. Check under the directory examples/aop/sensor that contains the full source and instructions to run.

Conclusion

In this article we have demonstrated the capability of JBoss Cache acting as a POJO cache by leveraging the TreeCacheAop component. By using the POJO cache functionality, it provides seamless failover capability for POJOs by performing fine-grained replication while preserving object-graph relationship.

Acknowledgment

The author would like to acknowledge Mr. Yusuke Komori of SMG Co. from Japan for kindly contributing the use case in this article.