Skip to content

Commit a92822c

Browse files
author
James Taylor
committed
Got rid of the ICompositeCache and ICacheHub interfaces in favor of using
CompositeCache itself. Saves a lot of casting and try catch blocks and makes the core nature of the CompositeCache more clear. git-svn-id: https://svn.apache.org/repos/asf/jakarta/jcs/trunk@223982 13f79535-47bb-0310-9956-ffa450edef68
1 parent f05cbec commit a92822c

17 files changed

+76
-199
lines changed

src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
7272
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
7373
import org.apache.jcs.engine.behavior.ICacheElement;
74-
import org.apache.jcs.engine.behavior.ICompositeCache;
74+
import org.apache.jcs.engine.control.CompositeCache;
7575
import org.apache.jcs.engine.control.CompositeCacheManager;
7676

7777
/**
@@ -265,7 +265,7 @@ public void handleDispose( String cacheName )
265265
/**
266266
* Gets the cacheManager attribute of the LateralCacheTCPListener object
267267
*/
268-
protected ICompositeCache getCache( String name )
268+
protected CompositeCache getCache( String name )
269269
{
270270
if ( cacheMgr == null )
271271
{
@@ -277,7 +277,7 @@ protected ICompositeCache getCache( String name )
277277
}
278278
}
279279

280-
return ( ICompositeCache ) cacheMgr.getCache( name );
280+
return cacheMgr.getCache( name );
281281
}
282282

283283
// ---------------------------------------------------------- inner classes

src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@
1414

1515
import org.apache.jcs.engine.behavior.ICache;
1616
import org.apache.jcs.engine.behavior.ICacheElement;
17-
import org.apache.jcs.engine.behavior.ICacheManager;
18-
import org.apache.jcs.engine.behavior.ICompositeCache;
1917

2018
import org.apache.jcs.engine.control.CompositeCache;
21-
2219
import org.apache.jcs.engine.control.CompositeCacheManager;
23-
import org.apache.jcs.engine.CacheConstants;
2420

2521
import org.apache.commons.logging.Log;
2622
import org.apache.commons.logging.LogFactory;
@@ -205,7 +201,7 @@ public void handlePut( ICacheElement cb )
205201
}
206202

207203
getCacheManager();
208-
ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache( cb.getCacheName() );
204+
CompositeCache cache = cacheMgr.getCache( cb.getCacheName() );
209205

210206
cache.localUpdate( cb );
211207
}

src/java/org/apache/jcs/auxiliary/remote/group/RemoteGroupCacheListener.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,25 @@
1616
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
1717
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
1818

19-
import org.apache.jcs.engine.behavior.ICache;
2019
import org.apache.jcs.engine.behavior.ICacheElement;
21-
import org.apache.jcs.engine.behavior.ICompositeCache;
2220

2321
import org.apache.jcs.engine.control.group.GroupAttrName;
2422
import org.apache.jcs.engine.control.group.GroupAttrName;
2523
import org.apache.jcs.engine.control.group.GroupAttrName;
2624
import org.apache.jcs.engine.control.group.GroupCache;
2725
import org.apache.jcs.engine.control.group.GroupCache;
2826
import org.apache.jcs.engine.control.group.GroupCache;
27+
28+
import org.apache.jcs.engine.control.CompositeCache;
2929
import org.apache.jcs.engine.control.CompositeCacheManager;
30-
import org.apache.jcs.engine.CacheConstants;
3130

3231
import org.apache.commons.logging.Log;
3332
import org.apache.commons.logging.LogFactory;
3433

35-
// remove
36-
3734
/**
3835
* Description of the Class
3936
*
4037
* @author asmuts
41-
* @created January 15, 2002
4238
*/
4339
public class RemoteGroupCacheListener extends RemoteCacheListener implements IRemoteCacheListener, IRemoteCacheConstants, Serializable
4440
{
@@ -141,7 +137,7 @@ public void handlePut( ICacheElement cb )
141137
}
142138

143139
getCacheManager();
144-
ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache( irca.getCacheName() );
140+
CompositeCache cache = cacheMgr.getCache( irca.getCacheName() );
145141
cache.localUpdate( cb );
146142

147143
}

src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@
2525

2626
import org.apache.jcs.engine.CacheEventQueue;
2727
import org.apache.jcs.engine.CacheListeners;
28-
import org.apache.jcs.engine.CacheConstants;
2928

30-
import org.apache.jcs.engine.behavior.ICache;
3129
import org.apache.jcs.engine.behavior.ICacheElement;
3230
import org.apache.jcs.engine.behavior.ICacheEventQueue;
3331
import org.apache.jcs.engine.behavior.ICacheListener;
34-
import org.apache.jcs.engine.behavior.ICompositeCache;
3532

33+
import org.apache.jcs.engine.control.CompositeCache;
3634
import org.apache.jcs.engine.control.CompositeCacheManager;
3735

3836
import org.apache.commons.logging.Log;
@@ -259,7 +257,7 @@ public void update( ICacheElement item, byte requesterId )
259257
{
260258
try
261259
{
262-
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
260+
CompositeCache c = ( CompositeCache ) cacheDesc.cache;
263261

264262
//TODO; make this a bit less of a hack
265263
// If the source of this request was from a cluster, then
@@ -298,7 +296,7 @@ public void update( ICacheElement item, byte requesterId )
298296

299297
// UPDATE LOCALS IF A REQUEST COMES FROM A CLUSTER
300298
// IF LOCAL CLUSTER CONSISTENCY IS CONFIGURED
301-
ICompositeCache cache = ( ICompositeCache ) cacheDesc.cache;
299+
302300
if ( !fromCluster || ( fromCluster && rcsa.getLocalClusterConsistency() ) )
303301
{
304302

@@ -413,7 +411,7 @@ public ICacheElement get( String cacheName, Serializable key )
413411
}
414412
else
415413
{
416-
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
414+
CompositeCache c = ( CompositeCache ) cacheDesc.cache;
417415

418416
return c.localGet( key );
419417
}
@@ -454,7 +452,7 @@ public void remove( String cacheName, Serializable key, byte requesterId )
454452
boolean removeSuccess = false;
455453

456454
// No need to notify if it was not cached.
457-
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
455+
CompositeCache c = ( CompositeCache ) cacheDesc.cache;
458456

459457
if ( fromCluster )
460458
{
@@ -478,7 +476,7 @@ public void remove( String cacheName, Serializable key, byte requesterId )
478476

479477
// UPDATE LOCALS IF A REQUEST COMES FROM A CLUSTER
480478
// IF LOCAL CLUSTER CONSISTENCY IS CONFIGURED
481-
ICompositeCache cache = ( ICompositeCache ) cacheDesc.cache;
479+
482480
if ( !fromCluster || ( fromCluster && rcsa.getLocalClusterConsistency() ) )
483481
{
484482

src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerListener.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414

1515
import org.apache.jcs.engine.behavior.ICache;
1616
import org.apache.jcs.engine.behavior.ICacheElement;
17-
import org.apache.jcs.engine.behavior.ICacheManager;
18-
import org.apache.jcs.engine.behavior.ICompositeCache;
1917

2018
import org.apache.jcs.engine.control.CompositeCache;
2119
import org.apache.jcs.engine.control.CompositeCacheManager;
22-
import org.apache.jcs.engine.CacheConstants;
2320

2421
import org.apache.commons.logging.Log;
2522
import org.apache.commons.logging.LogFactory;
@@ -187,7 +184,8 @@ public void handlePut( ICacheElement cb )
187184
log.debug( "puts = " + puts );
188185
}
189186
}
190-
ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache( irca.getCacheName() );
187+
188+
CompositeCache cache = cacheMgr.getCache( irca.getCacheName() );
191189
cache.localUpdate( cb );
192190
}
193191

src/java/org/apache/jcs/engine/CacheListeners.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import java.util.Hashtable;
44
import java.util.Map;
55

6-
import org.apache.jcs.engine.behavior.ICache;
7-
import org.apache.jcs.engine.behavior.ICompositeCache;
6+
import org.apache.jcs.engine.behavior.ICache;;
87

98
/**
109
* Used to associates a set of [cache listener to cache event queue] for a

src/java/org/apache/jcs/engine/behavior/ICacheHub.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/java/org/apache/jcs/engine/behavior/ICompositeCache.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/java/org/apache/jcs/engine/control/CompositeCache.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
import org.apache.jcs.engine.behavior.ICache;
7070
import org.apache.jcs.engine.behavior.ICacheElement;
7171
import org.apache.jcs.engine.behavior.ICacheType;
72-
import org.apache.jcs.engine.behavior.ICompositeCache;
7372
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
7473
import org.apache.jcs.engine.behavior.IElementAttributes;
7574

@@ -94,7 +93,7 @@
9493
*@version $Id$
9594
*/
9695
public class CompositeCache
97-
implements ICache, ICompositeCache, Serializable
96+
implements ICache, Serializable
9897
{
9998
private final static Log log = LogFactory.getLog( CompositeCache.class );
10099

src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ protected void parseRegions( Properties props )
173173
}
174174

175175
/** Create cache region. */
176-
protected ICache parseRegion( Properties props,
176+
protected CompositeCache parseRegion( Properties props,
177177
String regName,
178178
String value )
179179
{
180180
return parseRegion( props, regName, value, null, REGION_PREFIX );
181181
}
182182

183183
/** */
184-
protected ICache parseRegion( Properties props,
184+
protected CompositeCache parseRegion( Properties props,
185185
String regName,
186186
String value,
187187
ICompositeCacheAttributes cca )
@@ -190,7 +190,7 @@ protected ICache parseRegion( Properties props,
190190
}
191191

192192
/** */
193-
protected ICache parseRegion( Properties props,
193+
protected CompositeCache parseRegion( Properties props,
194194
String regName,
195195
String value,
196196
ICompositeCacheAttributes cca,
@@ -244,7 +244,7 @@ protected ICache parseRegion( Properties props,
244244

245245
IElementAttributes ea = parseElementAttributes( props, regName, regionPrefix );
246246

247-
ICache cache = null;
247+
CompositeCache cache = null;
248248
if ( regionPrefix.equals( SYSTEM_REGION_PREFIX ) )
249249
{
250250
//cache = ccMgr.createSystemCache( regName, auxCaches, cca, new ElementAttributes() );

0 commit comments

Comments
 (0)