Author: dkatayev
Date: 2009-12-03 11:07:55 -0500 (Thu, 03 Dec 2009)
New Revision: 922
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
Log:
EXOJCR-296 4. In AbstractExoCache replace protected final Cache<Serializable,
Object> cache by protected final CacheSPI<Serializable, Object> cache
5. Remove all the references to isCacheSPI since it is useless, it will always be a
CacheSPI
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
---
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2009-12-03
15:57:59 UTC (rev 921)
+++
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2009-12-03
16:07:55 UTC (rev 922)
@@ -77,20 +77,13 @@
private final CopyOnWriteArrayList<CacheListener> listeners;
- protected final Cache<Serializable, Object> cache;
+ protected final CacheSPI<Serializable, Object> cache;
- protected final boolean isCacheSPI;
-
@SuppressWarnings("unchecked")
- public AbstractExoCache(ExoCacheConfig config, Cache<Serializable, Object>
cache)
+ public AbstractExoCache(ExoCacheConfig config, CacheSPI<Serializable, Object>
cache)
{
this.cache = cache;
- this.isCacheSPI = cache instanceof CacheSPI;
this.listeners = new CopyOnWriteArrayList<CacheListener>();
- if (!isCacheSPI)
- {
- LOG.warn("The cache is not an instance of CacheSPI, the cache size will be
evaluated but won't be accurate");
- }
setDistributed(config.isDistributed());
setLabel(config.getLabel());
setName(config.getName());
@@ -169,11 +162,7 @@
@SuppressWarnings("unchecked")
public int getCacheSize()
{
- if (isCacheSPI)
- {
- return ((CacheSPI)cache).getNumberOfNodes();
- }
- return size.intValue();
+ return cache.getNumberOfNodes();
}
/**
@@ -281,8 +270,6 @@
}
catch (Exception e)
{
- if (!isCacheSPI)
- size.addAndGet(-total);
cache.endBatch(false);
throw e;
}
@@ -515,10 +502,6 @@
// algorithms
onExpire(getKey(ne.getFqn()), null);
}
- else if (!isCacheSPI)
- {
- size.decrementAndGet();
- }
}
@NodeRemoved
@@ -533,19 +516,12 @@
onRemove(key, node.get(key));
}
}
- else if (!isCacheSPI)
- {
- size.decrementAndGet();
- }
}
@NodeCreated
public void nodeCreated(NodeEvent ne)
{
- if (!ne.isPre() && !isCacheSPI)
- {
- size.incrementAndGet();
- }
+ size.incrementAndGet();
}
@SuppressWarnings("unchecked")
Show replies by date