[jboss-dev-forums] [Design of JBossCache] - Configuration & CacheImpl overlap of concerns
genman
do-not-reply at jboss.com
Fri Apr 13 18:43:54 EDT 2007
There's a lot of logic embedded in CacheImpl.start() and create() as to what specific object instances are created. For example, the JGroups Channel, or the InterceptorChainFactory are directly constructed here and users have no control on this. A bunch of other objects are also created based on class names and whatnot; these are configurable to some extent but why does the CacheImpl need to know how to build these?
What really should be done is allow the Configuration class to play the role as factory class, and take out all factory details from the Cache itself.
I suggest for 2.0 that anything with "new Something()" or Class.newInstance() in Cache be moved to the Configuration object. I would consider moving out the following:
| RegionManager
| Notifier
| StateTransferManager
| ReplicationQueue
| InterceptorChainFactory
| BuddyManager
| CacheJmxWrapper
| OptimisticTransactionEntry, TransactionEntry
|
As an example:
public synchronized RegionManager getRegionManager()
| {
| if (regionManager == null)
| {
| regionManager = new RegionManager(this);
| }
| return regionManager;
| }
|
should be rewritten as:
| public synchronized RegionManager getRegionManager()
| {
| if (regionManager == null)
| {
| regionManager = configuration.createRegionManager();
| }
| return regionManager;
| }
|
This all somewhat is related to:
http://jira.jboss.com/jira/browse/JBCACHE-1023
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037261#4037261
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037261
More information about the jboss-dev-forums
mailing list