2 Replies Latest reply on Jul 12, 2007 6:11 AM by galder.zamarreno

    SingletonStoreCacheLoader: upgrade to java.util.concurrent?

    galder.zamarreno

      I was just about to finish http://jira.jboss.com/jira/browse/JBCACHE-1091 when I have realised that SingletonStoreCacheLoader was still developed under the old Threading model. Seeing as I'm reading the JCIP book, I thought it'd be good to change SingletonStoreCacheLoader to use java.util.concurrent classes.

      I then realised that actually, with java.util.concurrent, I can now set a timeout to the in-memory state push to cache loader very easily with a Future, which would be a nice add on to singleton store. This is currently implemented via a Thread.join().

      All this has lead to me think whether XML configuration should still look like this:

      <singletonStore class="org.jboss.cache.loader.SingletonStoreCacheLoader" pushStateWhenCoordinator="false">false</singletonStore>
      


      This format probably not the most appropiate going forward, if I wanna add a push timeout and if we look at configuration style used for cacheloaders and buddyreplication.

      We're not GA yet, so we still have the chance to change this (although maybe it should have happened during the Beta period)

      So, this is the configuration I would suggest going forward:

      <cacheloader>
       ....
       <singletonStore>
       <enabled>true</enabled>
       <class>org.jboss.cache.loader.SingletonStoreCacheLoader</class>
       <pushStateWhenCoordinator timeout="60">true</pushStateWhenCoordinator>
       </singletonStore>
       ...
      <cacheloader>
      


      Seeing that we're now providing users with the ability to set the class, maybe we wanna be more flexibles in the way the properties are set for this cache loader, in similar fashion to buddy locator?

      <cacheloader>
       ....
       <singletonStore>
       <enabled>true</enabled>
       <class>org.jboss.cache.loader.SingletonStoreCacheLoader</class>
       <properties>
       pushStateWhenCoordinator = true
       pushStateWhenCoordinatorTimeout = 60
       </properties>
       </singletonStore>
       ...
      <cacheloader>
      


      Right now, my preference is with the second one as it allows to extend the implementation and it's corresponding properties/settings in a tidier way.

      I think I could have all this done by the end of next week latest.

      Thoughts? Manik?