[jboss-dev-forums] [Design of JBossCache] - JBoss Cache Options API

manik.surtani@jboss.com do-not-reply at jboss.com
Thu Jan 29 07:03:29 EST 2009


This has come up in the past, and I want to revisit this for a potential future improvement to the API.

Options are hugely useful in being able to provide additional per-invocation context and overrides.

But the current mechanism is nothing short of kludgey:


  |    cache.getInvocationContext().getOptionOverrides().setXYZ();
  |    cache.doSomething(); // your invocation
  | 

Ugly since it involves thread locals and there is a lot of code to check for leaks, proper cleanup, context leaking to additional calls, nested calls with notifications, etc etc etc.

So I'm looking for suggestions for a better approach here.  

FYI, the way this was done in JBC 1.4.x (which is still ugly IMO) was to overload all methods on the cache with versions that took in an Option class.

e.g., 


  |    cache.get(Fqn f, Object key);
  |    cache.get(Fqn f, Object key, Option o);
  | 

Thoughts and suggestions?

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

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



More information about the jboss-dev-forums mailing list