This thread is to discuss
http://jira.jboss.com/jira/browse/JBCACHE-1134.
Here's a summary of my thoughts taken from JIRA:
In the org.jboss.cache.loader package, we have:
o.j.c.l.DelegatingCacheLoader and
o.j.c.l.AbstractDelegatingCacheLoader
The second one was created by me when I first created SingletonStoreCL (doh!). I
refactored common code from AsyncCL to AbstractDelegatingCL and made AsyncCL and
SingletonStoreCL extend it.
I have just spotted DelegatingCacheLoader which is extended by LocalDelegatingCacheLoader
and TcpDelegatingCacheLoader.
The difference between the classes extending DelegatingCacheLoader and the classes
extending AbstractDelegatingCacheLoader is:
Classes extending DelegatingCacheLoader
(LocalDelegatingCacheLoader/TcpDelegatingCacheLoader) are standalone classloaders that
delegate to other cache instances. ClusteredCacheLoader could be defined as a refined
delegating cache loader in comparison to LDCL and TDCL, in the sense that they delegate
get() calls, but don't delegate put() calls because replication takes care of it.
Classes extending AbstractDelegatingCacheLoader are decorators of other
class loaders that delegate to cache loaders instead of other caches. As such,
AbstractDelegatingCacheLoader adds getCacheLoader()/setCacheLoader() methods that help the
interaction between the decorator cache loader and the real cache loader.
So, this is what I'm proposing:
- two interfaces, one for CLs that delegate to caches and one for CLs that delegate to
CLs.
- provide abstract implementations for these interfaces with common functionality.
- refactor CL implementations to adhere to this hierarchy. This should include making
ClusteredCacheLoader implement the interface or extend the abstract implementation, of a
CL that delegates to another cache taking in account that it only delegates get()
operations.
Thoughts?
p.s. interfaces need a bit more baking to define the names and the contract...etc.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063877#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...