[jboss-dev-forums] [Design of JBossCache] - Reusing options in PojoCache

bstansberry@jboss.com do-not-reply at jboss.com
Wed Oct 31 17:13:00 EDT 2007


Jason,

Just got bit by a bad practice, and I see PojoCache is doing the same thing (at least in 1.4.1.x), so wanted to give you a heads up.

The bad practice is trying to reuse an Option -- i.e. create and configure an Option, cache a ref to that instance and then pass that instance to the cache whenever you make an invocation w/ that semantic.

PojoCache does this in InternalDelegate with the gravitateOption_ and skipLockOption_ fields.

This is a problem because JBC makes no guarantees that it won't change the internal state of an Option during the course of an invocation.  Manik and I had a discussion about this a couple weeks back, but I can't find it to give you a link.  JBCACHE-1209 is an example of a subtle issue where JBC was changing the internal state of an option the AS code was trying to reuse.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100856#4100856

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100856



More information about the jboss-dev-forums mailing list