[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Tue Jan 23 08:54:48 EST 2007
User: msurtani
Date: 07/01/23 08:54:48
Modified: src/org/jboss/cache/interceptors
CacheLoaderInterceptor.java
Log:
cleaned up custom cache loader malarky
Revision Changes Path
1.76 +1 -32 JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- CacheLoaderInterceptor.java 23 Jan 2007 05:37:34 -0000 1.75
+++ CacheLoaderInterceptor.java 23 Jan 2007 13:54:48 -0000 1.76
@@ -28,11 +28,10 @@
* Loads nodes that don't exist at the time of the call into memory from the CacheLoader
*
* @author Bela Ban
- * @version $Id: CacheLoaderInterceptor.java,v 1.75 2007/01/23 05:37:34 bstansberry Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.76 2007/01/23 13:54:48 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
- private boolean isCustomCacheLoader;
private long m_cacheLoads = 0;
private long m_cacheMisses = 0;
private TransactionTable txTable = null;
@@ -48,39 +47,9 @@
public void setCache(CacheSPI cache)
{
super.setCache(cache);
- isCustomCacheLoader = isCustomCacheLoaderConfigured(loader);
txTable = cache.getTransactionTable();
}
- private boolean isCustomCacheLoaderConfigured(CacheLoader cl)
- {
- if (cl instanceof ChainingCacheLoader)
- {
- // test all loaders in the chain.
- ChainingCacheLoader ccl = (ChainingCacheLoader) cl;
- Iterator it = ccl.getCacheLoaders().iterator();
- boolean isCustom = false;
- while (it.hasNext())
- {
- CacheLoader nextCacheLoader = (CacheLoader) it.next();
- isCustom = isCustom || isCustomCacheLoaderConfigured(nextCacheLoader);
- }
- return isCustom;
- }
- else if (cl instanceof AsyncCacheLoader)
- {
- // test the underlying cache loader
- CacheLoader underlying = ((AsyncCacheLoader) cl).getCacheLoader();
- return isCustomCacheLoaderConfigured(underlying);
- }
- else
- {
- // tests for org.jboss.cache.loader.*
- Package pkg = cl.getClass().getPackage();// may be null if this is an inner class? In which case it is certainly a custom cache loader instance.
- return pkg == null || !pkg.getName().startsWith("org.jboss.cache");
- }
- }
-
/**
* Makes sure a node is loaded into memory before a call executes (no-op if node is already loaded). If attributes
* of a node are to be accessed by the method, the attributes are also loaded.
More information about the jboss-cvs-commits
mailing list