[jboss-dev-forums] [Design of JBossCache] - Re: Consolidate delegating cache loader classes [JBCACHE-113

manik.surtani@jboss.com do-not-reply at jboss.com
Mon Jul 16 17:01:00 EDT 2007


If you look at the DelegatingCacheLoader, it doesn't really do anything at all except proxy calls to abstract methods that need implementing - e.g., put() -> delegatePut(), get() -> delegateGet(), etc etc.  Why not just have the implementation (E.g., TcpDelegatingCacheLoader) just implement CacheLoader directly rather than extend DelegatingCacheLoader (the way CCL does)?  You have to implement the same number of methods anyway.

The only thing DCL adds is tracking transactions in a map.  This is also done in AbstractCacheLoader, which DCL ought to extend.

Now if DCL provided no-op impls of the delegateXYZ() methods, then this makes sense since the implementation class could only override calls it would like to delegate.

In this case I see a benefit for CCL extending DCL.

AbstractDelegatingCacheLoader (which delegates to other cache loaders) - makes more sense in it's implementation, although I don't quite see much to be consolidated between ADCL and DCL.

What does need refactoring though is the names!  AbstractDelegatingCacheLoader (delegates to cache loaders) and DelegatingCacheLoader (delegates to caches)?  Hugely confusing.  :-)

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

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



More information about the jboss-dev-forums mailing list