5 Replies Latest reply on Nov 1, 2007 1:23 PM by Brian Stansberry

    Reusing options in PojoCache

    Brian Stansberry Master

      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.