JBoss Cache SVN: r5773 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-04-30 11:16:01 -0400 (Wed, 30 Apr 2008)
New Revision: 5773
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
Log:
renamed start method
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-30 14:29:13 UTC (rev 5772)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-30 15:16:01 UTC (rev 5773)
@@ -71,7 +71,7 @@
}
@Start
- private void init()
+ private void initTxMap()
{
optimistic = configuration.isNodeLockingOptimistic();
if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction, List<ReversibleCommand>>();
16 years, 8 months
JBoss Cache SVN: r5772 - in core/trunk/src/main/java/org/jboss/cache: eviction and 8 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 10:29:13 -0400 (Wed, 30 Apr 2008)
New Revision: 5772
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainer.java
core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java
core/trunk/src/main/java/org/jboss/cache/eviction/BaseEvictionAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/C3p0ConnectionFactory.java
core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/ManagedConnectionFactory.java
core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java
core/trunk/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java
core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/trunk/src/main/java/org/jboss/cache/util/BeanUtils.java
Log:
static loggers and trace optimisations
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -6,7 +6,6 @@
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -28,7 +27,7 @@
{
// TODO: 2.2.0: Refactor and standardise method names, consolidate where possible. A lot of these can be moved into commands.
private static final Log log = LogFactory.getLog(DataContainer.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
private Configuration configuration;
@@ -44,12 +43,6 @@
this.configuration = configuration;
}
- @Start
- public void start()
- {
- trace = log.isTraceEnabled();
- }
-
/**
* Set<Fqn> of Fqns of the topmost node of internal regions that should
* not included in standard state transfers.
Modified: core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/LifecycleManager.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -32,8 +32,7 @@
*/
public class LifecycleManager
{
- private static Log log = LogFactory.getLog(LifecycleManager.class);
-
+ private static final Log log = LogFactory.getLog(LifecycleManager.class);
private CacheStatus cacheStatus;
/* dependencies*/
@@ -238,22 +237,6 @@
correctRootNodeType();
- switch (configuration.getCacheMode())
- {
- case LOCAL:
- log.debug("cache mode is local, will not create the channel");
- break;
- case REPL_SYNC:
- case REPL_ASYNC:
- case INVALIDATION_ASYNC:
- case INVALIDATION_SYNC:
- // reconfigure log category so that the instance name is reflected as well.
- configureLogCategory();
- break;
- default:
- throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
- }
-
startManualComponents();
// start any eviction threads.
@@ -314,9 +297,6 @@
*/
private void internalCreate() throws CacheException
{
- // Include our clusterName in our log category
- configureLogCategory();
-
componentRegistry.wire();
correctRootNodeType();
@@ -409,38 +389,6 @@
if (!tempRootType.equals(currentRootType)) dataContainer.setRoot(tempRoot);
}
- /**
- * Set our log category to include our clusterName, if we have one.
- */
- private void configureLogCategory()
- {
- StringBuilder category = new StringBuilder(getClass().getName());
- if (configuration != null)
- {
- if (rpcManager != null)
- {
- String clusterName = configuration.getClusterName();
- if (clusterName != null)
- {
- category.append('.');
- category.append(clusterName);
- if (rpcManager.getLocalAddress() != null)
- {
- category.append('.');
- category.append(rpcManager.getLocalAddress().toString().replace('.', '_'));
- }
- }
- }
- else
- {
- // we're in LOCAL mode
- category.append("_LOCAL");
- }
- }
- // replace .s with _s otherwise Log4J will strip them out
- log = LogFactory.getLog(category.toString());
- }
-
private void startManualComponents()
{
// these 2 components need to be started manually since they can only be started after ALL other components have started.
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/BaseEvictionAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/BaseEvictionAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/BaseEvictionAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -30,6 +30,7 @@
public abstract class BaseEvictionAlgorithm implements EvictionAlgorithm
{
private static final Log log = LogFactory.getLog(BaseEvictionAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
/**
* Mapped region.
@@ -105,7 +106,7 @@
this.initialize(region);
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("process(): region: " + region.getFqn());
}
@@ -177,7 +178,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("processed " + count + " node events in region: " + region.getFqn());
}
@@ -219,7 +220,7 @@
*/
protected boolean evictCacheNode(Fqn fqn)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Attempting to evict cache node with fqn of " + fqn);
}
@@ -241,7 +242,7 @@
return false;
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Eviction of cache node with fqn of " + fqn + " successful");
}
@@ -251,7 +252,7 @@
protected void processMarkInUseNodes(Fqn fqn, long inUseTimeout) throws EvictionException
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Marking node " + fqn + " as in use with a usage timeout of " + inUseTimeout);
}
@@ -265,7 +266,7 @@
protected void processUnmarkInUseNodes(Fqn fqn) throws EvictionException
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Unmarking node " + fqn + " as in use");
}
@@ -293,7 +294,7 @@
{
Fqn fqn = evictedEventNode.getFqn();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Adding node " + fqn + " with " + numAddedElements + " elements to eviction queue");
}
@@ -311,7 +312,7 @@
{
ne.setNumberOfElements(ne.getNumberOfElements() + numAddedElements);
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Queue already contains " + ne.getFqn() + " processing it as visited");
}
@@ -326,7 +327,7 @@
evictionQueue.addNodeEntry(ne);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace(ne.getFqn() + " added successfully to eviction queue");
}
@@ -351,7 +352,7 @@
{
Fqn fqn = evictedEventNode.getFqn();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Removing node " + fqn + " from eviction queue and attempting eviction");
}
@@ -373,7 +374,7 @@
}
else
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("processRemoveNodes(): Can't find node associated with fqn: " + fqn
+ "Could have been evicted earlier. Will just continue.");
@@ -381,7 +382,7 @@
return;
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace(fqn + " removed from eviction queue");
}
@@ -446,7 +447,7 @@
NodeEntry ne = evictionQueue.getNodeEntry(fqn);
if (ne == null)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Adding element " + fqn + " for a node that doesn't exist yet. Process as an add.");
}
@@ -489,14 +490,14 @@
if (fqn == null)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Recycle queue is empty");
}
break;
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("emptying recycle bin. Evict node " + fqn);
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -8,7 +8,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
@@ -26,6 +25,7 @@
public abstract class BaseSortedEvictionAlgorithm extends BaseEvictionAlgorithm
{
private static final Log log = LogFactory.getLog(BaseSortedEvictionAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
@Override
public void process(Region region) throws EvictionException
@@ -42,8 +42,6 @@
int count = 0;
while ((node = region.takeLastEventNode()) != null)
{
- Fqn fqn = node.getFqn();
-
count++;
switch (node.getEventType())
{
@@ -71,7 +69,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Eviction nodes visited or added requires resort of queue " + evictionNodesModified);
}
@@ -79,7 +77,7 @@
this.resortEvictionQueue(evictionNodesModified);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("processed " + count + " node events");
}
@@ -108,7 +106,7 @@
((SortedEvictionQueue) evictionQueue).resortEvictionQueue();
long end = System.currentTimeMillis();
- if (log.isTraceEnabled())
+ if (trace)
{
long diff = end - begin;
log.trace("Took " + diff + "ms to sort queue with " + getEvictionQueue().getNumberOfNodes() + " elements");
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -52,6 +52,7 @@
{
private static final Log log = LogFactory.getLog(ExpirationAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
private ExpirationConfiguration config;
@@ -93,7 +94,7 @@
private void setExpiration(Fqn fqn, Long l)
{
ExpirationEntry ee = new ExpirationEntry(fqn, l);
- if (log.isTraceEnabled())
+ if (trace)
log.trace("adding eviction entry: " + ee);
set.add(ee);
}
@@ -138,7 +139,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("processed " + count + " node events in region: " + region.getFqn());
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -20,6 +20,7 @@
public class FIFOAlgorithm extends BaseEvictionAlgorithm
{
private static final Log log = LogFactory.getLog(FIFOAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
@Override
@@ -39,7 +40,7 @@
if (isYoungerThanMinimumTimeToLive(ne)) return false;
FIFOConfiguration config = (FIFOConfiguration) region.getEvictionPolicyConfig();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Deciding whether node in queue " + ne.getFqn() + " requires eviction.");
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -35,11 +35,12 @@
public class LFUAlgorithm extends BaseSortedEvictionAlgorithm
{
private static final Log log = LogFactory.getLog(LFUAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
@Override
protected boolean shouldEvictNode(NodeEntry ne)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Deciding whether node in queue " + ne.getFqn() + " requires eviction.");
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -23,6 +23,7 @@
public class LRUAlgorithm extends BaseEvictionAlgorithm
{
private static final Log log = LogFactory.getLog(LRUAlgorithm.class);
+ private static final boolean trace = log.isTraceEnabled();
@Override
protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException
@@ -45,13 +46,13 @@
if (config.getTimeToLiveSeconds() != 0)
{
long idleTime = currentTime - entry.getModifiedTimeStamp();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + entry.getFqn() + " has been idle for " + idleTime + "ms");
}
if ((idleTime >= (config.getTimeToLiveSeconds() * 1000)))
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + entry.getFqn() + " should be evicted because of idle time");
log.trace("Time to live in millies is: " + (config.getTimeToLiveSeconds() * 1000));
@@ -64,13 +65,13 @@
if (config.getMaxAgeSeconds() != 0)
{
long objectLifeTime = currentTime - entry.getCreationTimeStamp();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + entry.getFqn() + " has been alive for " + objectLifeTime + "ms");
}
if ((objectLifeTime >= (config.getMaxAgeSeconds() * 1000)))
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + entry.getFqn() + " should be evicted because of max age");
}
@@ -78,7 +79,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + entry.getFqn() + " should not be evicted");
}
@@ -161,7 +162,7 @@
while (evictionQueue.getNumberOfNodes() > maxNodes)
{
ne = (NodeEntry) it.next();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Node " + ne.getFqn() + " will be evicted because of exceeding the maxNode limit." +
" maxNode: " + maxNodes + " but current queue size is: " + evictionQueue.getNumberOfNodes());
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/NodeEntry.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -1,7 +1,5 @@
package org.jboss.cache.eviction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
/**
@@ -22,7 +20,6 @@
private boolean currentlyInUse = false;
EvictionQueue queue;
- private static Log log = LogFactory.getLog(NodeEntry.class);
/**
* Private constructor that automatically sets the creation time stamp of the node entry.
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -79,6 +79,7 @@
Map<Class, Class<? extends ComponentFactory>> defaultFactories = null;
private static final Log log = LogFactory.getLog(ComponentRegistry.class);
+ private static final boolean trace = log.isTraceEnabled();
private Bootstrap bootstrap;
// cache of reflection methods to call during injections. These will be emptied when start() is called.
@@ -173,14 +174,14 @@
// this will make sure all dependent components are stopped or set to CONSTRUCTED so they can be re-wired later.
Component c = new Component(name, component, type);
Component old = componentLookup.get(name);
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Registering component " + c + " under name " + name + " replacing old component " + old);
if (old != null)
{
// if they are equal don't bother
if (old.instance.equals(component))
{
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Attempting to register a component equal to one that already exists under the same name (" + name + "). Not doing anything.");
return;
}
@@ -321,7 +322,7 @@
}
else if (attemptedFactoryConstruction)
{
- if (log.isTraceEnabled()) log.trace("Registering a null for component " + componentNameToUse);
+ if (trace) log.trace("Registering a null for component " + componentNameToUse);
registerNullComponent(componentNameToUse, componentClass);
}
}
@@ -447,17 +448,17 @@
*/
public void wireDependencies(Object target) throws ConfigurationException
{
- //if (log.isTraceEnabled()) log.trace("Inspecting class " + target.getClass());
+ //if (trace) log.trace("Inspecting class " + target.getClass());
try
{
// look in caches first
List<CachedMethod> methods = lookupInjectionMethods(target.getClass());
- //if (log.isTraceEnabled()) log.trace("Found method set containing " + methods.size() + " methods that need injection: " + methods);
+ //if (trace) log.trace("Found method set containing " + methods.size() + " methods that need injection: " + methods);
// search for anything we need to inject
for (CachedMethod method : methods)
{
- //if (log.isTraceEnabled()) log.trace("Method " + method + " needs some other components injected!");
+ //if (trace) log.trace("Method " + method + " needs some other components injected!");
performInjection(method, target);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -48,6 +48,7 @@
protected CacheSPI cache;
protected RegionManager regionManager;
private static final Log log = LogFactory.getLog(AbstractCacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
/**
* HashMap<Object,List<Modification>>. List of open transactions. Note that this is purely transient, as
* we don't use a log, recovery is not available
@@ -249,7 +250,7 @@
{
List<NodeData> list = new LinkedList<NodeData>();
getNodeDataList(fqn, list);
- if (log.isTraceEnabled()) log.trace("Loading state of " + list.size() + " nodes into stream");
+ if (trace) log.trace("Loading state of " + list.size() + " nodes into stream");
cache.getMarshaller().objectToObjectStream(list, out, fqn);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -80,6 +80,7 @@
{
private static final Log log = LogFactory.getLog(AsyncCacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
private static AtomicInteger threadId = new AtomicInteger(0);
@@ -258,7 +259,7 @@
{
throw new CacheException("AsyncCacheLoader stopped; no longer accepting more entries.");
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Enqueuing modification " + mod);
}
@@ -322,9 +323,9 @@
try
{
- if (log.isTraceEnabled()) log.trace("process remaining batch " + mods.size());
+ if (trace) log.trace("process remaining batch " + mods.size());
put(mods);
- if (log.isTraceEnabled()) log.trace("process remaining queued " + queue.size());
+ if (trace) log.trace("process remaining queued " + queue.size());
while (!queue.isEmpty())
{
run0();
@@ -346,7 +347,7 @@
mods.add(m);
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Calling put(List) with " + mods.size() + " modifications");
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/C3p0ConnectionFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/C3p0ConnectionFactory.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/C3p0ConnectionFactory.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -24,6 +24,7 @@
public class C3p0ConnectionFactory extends NonManagedConnectionFactory
{
private static final Log log = LogFactory.getLog(C3p0ConnectionFactory.class);
+ private static final boolean trace = log.isTraceEnabled();
private DataSource ds;
@@ -89,7 +90,7 @@
public Connection checkoutConnection() throws SQLException
{
Connection connection = ds.getConnection();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Connection checked out: " + connection);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -65,7 +65,7 @@
*/
public class CacheLoaderManager
{
- private static Log log = LogFactory.getLog(CacheLoaderManager.class);
+ private static final Log log = LogFactory.getLog(CacheLoaderManager.class);
private CacheLoaderConfig config;
private CacheSPI cache;
private CacheLoader loader;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -49,7 +49,8 @@
@ThreadSafe
public class ClusteredCacheLoader extends AbstractCacheLoader
{
- private static Log log = LogFactory.getLog(ClusteredCacheLoader.class);
+ private static final Log log = LogFactory.getLog(ClusteredCacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
private StripedLock lock = new StripedLock();
private ClusteredCacheLoaderConfig config;
private CommandsFactory commandsFactory;
@@ -110,7 +111,7 @@
private Object callRemote(DataCommand dataCommand) throws Exception
{
- if (log.isTraceEnabled()) log.trace("cache=" + cache.getLocalAddress() + "; calling with " + dataCommand);
+ if (trace) log.trace("cache=" + cache.getLocalAddress() + "; calling with " + dataCommand);
List<Address> mbrs = cache.getMembers();
ClusteredGetCommand clusteredGet = commandsFactory.buildClusteredGetCommand(false, dataCommand);
List resps = null;
@@ -155,7 +156,7 @@
// keep looping to see if anyone else responded
}
- if (log.isTraceEnabled()) log.trace("got responses " + resps);
+ if (trace) log.trace("got responses " + resps);
return result;
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -36,7 +36,6 @@
@ThreadSafe
public class JDBCCacheLoader extends AdjListJDBCCacheLoader
{
-
private static final Log log = LogFactory.getLog(JDBCCacheLoader.class);
private JDBCCacheLoaderConfig config;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ManagedConnectionFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ManagedConnectionFactory.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ManagedConnectionFactory.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -24,6 +24,7 @@
public class ManagedConnectionFactory implements ConnectionFactory
{
private static final Log log = LogFactory.getLog(ManagedConnectionFactory.class);
+ private static final boolean trace = log.isTraceEnabled();
private DataSource dataSource;
private String datasourceName;
@@ -42,7 +43,7 @@
{
ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup(datasourceName);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Datasource lookup for " + datasourceName + " succeded: " + dataSource);
}
@@ -71,7 +72,7 @@
throws SQLException
{
Connection connection = dataSource.getConnection();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Connection checked out: " + connection);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -22,6 +22,7 @@
class NonManagedConnectionFactory implements ConnectionFactory
{
private static final Log log = LogFactory.getLog(NonManagedConnectionFactory.class);
+ private static final boolean trace = log.isTraceEnabled();
static final ThreadLocal<Connection> connection = new ThreadLocal<Connection>();
@@ -62,7 +63,7 @@
and to trace log the connection opening in JDBCCacheLoader. */
connection.set(con);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("opened tx connection: tx=" + tx + ", con=" + con);
}
@@ -86,7 +87,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("using connection: " + con);
}
@@ -110,7 +111,7 @@
try
{
con.commit();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("committed tx=" + tx + ", con=" + con);
}
@@ -132,7 +133,7 @@
try
{
con.rollback();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("rolledback tx=" + tx + ", con=" + con);
}
@@ -155,7 +156,7 @@
{
con.close();
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("closed non tx connection: " + con);
}
@@ -195,7 +196,7 @@
{
try
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Attempting to load driver: " + drv);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -2,10 +2,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jboss.cache.notifications.annotation.CacheListener;
@@ -23,6 +23,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Vector;
+import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -30,7 +31,6 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import java.util.concurrent.Callable;
/**
* SingletonStoreCacheLoader is a delegating cache loader used for situations when only one node should interact with
@@ -56,6 +56,7 @@
* Log instance.
*/
private static final Log log = LogFactory.getLog(SingletonStoreCacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
/**
* Name of thread that should pushing in-memory state to cache loader.
@@ -86,7 +87,7 @@
/**
* Whether the the current node is the coordinator and therefore SingletonStoreCacheLoader is active. Being active
- * means delegating calls to the underlying cache loader.
+ * means delegating calls to the underlying cache loader.
*/
private boolean active;
@@ -109,7 +110,7 @@
/**
* Sets the config for SingletonStoreCacheLoader and for the delegating cache loader.
*/
- @Override
+ @Override
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig config)
{
super.setConfig(config);
@@ -117,7 +118,7 @@
SingletonStoreConfig ssc = config.getSingletonStoreConfig();
if (ssc instanceof SingletonStoreDefaultConfig)
{
- this.config = (SingletonStoreDefaultConfig)ssc;
+ this.config = (SingletonStoreDefaultConfig) ssc;
}
else if (ssc != null)
{
@@ -140,7 +141,7 @@
{
super.setCache(c);
- c.addCacheListener(new SingletonStoreListener());
+ c.addCacheListener(new SingletonStoreListener());
}
/**
@@ -198,7 +199,7 @@
* Factory method for the creation of a Callable task in charge of pushing in-memory state to cache loader.
*
* @return new instance of Callable<?> whose call() method either throws an exception or returns null if the task
- * was successfull.
+ * was successfull.
*/
protected Callable<?> createPushStateTask()
{
@@ -230,7 +231,7 @@
*
* @param node instance of NodeSPI to push to the cache loader
* @throws Exception if there's any issues reading the data from the cache or pushing the node's data to the cache
- * loader.
+ * loader.
*/
protected void pushState(NodeSPI node) throws Exception
{
@@ -251,15 +252,15 @@
//Map.Entry entry = (Map.Entry) aChildren;
pushState(aChildren);
}
- }
+ }
/**
* Method that waits for the in-memory to cache loader state to finish. This method's called in case a push state
* is already in progress and we need to wait for it to finish.
*
- * @param future instance of Future representing the on going push task
+ * @param future instance of Future representing the on going push task
* @param timeout time to wait for the push task to finish
- * @param unit instance of TimeUnit representing the unit of timeout
+ * @param unit instance of TimeUnit representing the unit of timeout
*/
protected void awaitForPushToFinish(Future future, int timeout, TimeUnit unit)
{
@@ -281,7 +282,7 @@
{
/* Re-assert the thread's interrupted status */
Thread.currentThread().interrupt();
- if (log.isTraceEnabled()) log.trace("wait for state push to cache loader to finish was interrupted");
+ if (trace) log.trace("wait for state push to cache loader to finish was interrupted");
}
}
@@ -318,9 +319,9 @@
/**
* Waits, within a time constraint, for a task to finish.
*
- * @param future represents the task waiting to finish.
+ * @param future represents the task waiting to finish.
* @param timeout maximum time to wait for the time to finish.
- * @param unit instance of TimeUnit representing the unit of timeout
+ * @param unit instance of TimeUnit representing the unit of timeout
* @throws Exception if any issues are reported while waiting for the task to finish
*/
private void waitForTaskToFinish(Future future, int timeout, TimeUnit unit) throws Exception
@@ -341,14 +342,14 @@
{
/* Re-assert the thread's interrupted status */
Thread.currentThread().interrupt();
- if (log.isTraceEnabled()) log.trace("task was interrupted");
+ if (trace) log.trace("task was interrupted");
}
finally
{
/* no-op if task is completed */
future.cancel(true); /* interrupt if running */
}
- }
+ }
/**
* Indicates whether the current nodes is the coordinator of the cluster.
@@ -417,7 +418,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public Object remove(Fqn fqn, Object key) throws Exception
{
@@ -431,7 +432,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void remove(Fqn fqn) throws Exception
{
@@ -443,7 +444,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void removeData(Fqn fqn) throws Exception
{
@@ -455,7 +456,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void prepare(Object tx, List<Modification> modifications, boolean one_phase) throws Exception
{
@@ -467,7 +468,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void commit(Object tx) throws Exception
{
@@ -479,7 +480,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void rollback(Object tx)
{
@@ -491,7 +492,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void storeEntireState(ObjectInputStream is) throws Exception
{
@@ -503,7 +504,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public void storeState(Fqn subtree, ObjectInputStream is) throws Exception
{
@@ -515,7 +516,7 @@
/**
* Calls the underlying cache loader's operation if the current node is the coordinator.
- */
+ */
@Override
public String toString()
{
@@ -574,7 +575,7 @@
}
/**
- * Exception representing any issues that arise from pushing the in-memory state to the cache loader.
+ * Exception representing any issues that arise from pushing the in-memory state to the cache loader.
*/
public static class PushStateException extends Exception
{
Modified: core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -60,6 +60,7 @@
public class JdbmCacheLoader extends AbstractCacheLoader
{
private static final Log log = LogFactory.getLog(JdbmCacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
private static final String KEYS = "K";
private static final String NODE = "N";
@@ -216,7 +217,7 @@
config = new JdbmCacheLoaderConfig(base);
}
- if (log.isTraceEnabled()) log.trace("Configuring cache loader with location = " + config.getLocation());
+ if (trace) log.trace("Configuring cache loader with location = " + config.getLocation());
}
public IndividualCacheLoaderConfig getConfig()
@@ -261,7 +262,7 @@
throws Exception
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("getChildrenNames " + name);
}
@@ -332,7 +333,7 @@
if (tree.find(name) == null)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("get, no node: " + name);
}
@@ -359,7 +360,7 @@
}
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("get " + name + " map=" + map);
}
@@ -403,7 +404,7 @@
makeNode(name);
Fqn rec = key(name, key);
Object oldValue = insert(rec, value);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("put " + rec + " value=" + value + " old=" + oldValue);
}
@@ -424,7 +425,7 @@
private void put0(Fqn name, Map<?, ?> values) throws Exception
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("put " + name + " values=" + values);
}
@@ -481,7 +482,7 @@
private void erase0(Fqn name, boolean self)
throws IOException
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("erase " + name + " self=" + self);
}
@@ -515,7 +516,7 @@
private Object eraseKey0(Fqn name, Object key)
throws IOException
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("eraseKey " + name + " key " + key);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -61,6 +61,7 @@
public class S3CacheLoader extends AbstractCacheLoader
{
private static final Log log = LogFactory.getLog(S3CacheLoader.class);
+ private static final boolean trace = log.isTraceEnabled();
/**
* Max number of dummy parent nodes to cache.
@@ -163,7 +164,7 @@
config = new S3LoaderConfig(base);
}
- if (log.isTraceEnabled())
+ if (trace)
log.trace("config=" + config);
}
@@ -214,7 +215,7 @@
{
String children = children(name);
ListResponse response = connection.list(getBucket(), children);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("getChildrenNames " + name + " response=" + response);
}
@@ -247,7 +248,7 @@
GetStreamResponse response = connection.getStream(getBucket(), key(name));
try
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("get " + name + " response=" + response);
}
@@ -279,7 +280,7 @@
public boolean exists(Fqn name) throws Exception
{
Response response = connection.head(getBucket(), key(name));
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("exists " + name + " response=" + response);
}
@@ -324,7 +325,7 @@
private void put0(Fqn name, S3Object obj) throws Exception
{
Response response = connection.put(getBucket(), key(name), obj);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("put " + name + " obj=" + obj + " response=" + response);
}
@@ -438,7 +439,7 @@
}
}
Response response = connection.delete(getBucket(), key(name));
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("delete " + name + " response=" + response);
}
Modified: core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -71,7 +71,7 @@
private boolean PRINT_LOCK_DETAILS = Boolean.getBoolean("print_lock_details");
private static final Log log = LogFactory.getLog(IdentityLock.class);
- private static boolean trace = log.isTraceEnabled();
+ private static final boolean trace = log.isTraceEnabled();
private final LockStrategy lock_;
private final LockMap map_;
private final boolean mustReacquireRead_;
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -25,7 +25,7 @@
*/
public class LockManager
{
- private static Log log = LogFactory.getLog(LockManager.class);
+ private static final Log log = LogFactory.getLog(LockManager.class);
private static final boolean trace = log.isTraceEnabled();
private Configuration configuration;
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -14,6 +14,7 @@
public abstract class LockUtil
{
private final static Log log = LogFactory.getLog(StateTransferManager.class);
+ private static final boolean trace = log.isTraceEnabled();
private static interface TransactionLockStatus extends Status
{
@@ -66,7 +67,7 @@
TransactionManager tm,
Object localAddress)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Attempting to acquire lock for node " + node.getFqn() +
" from owner " + curOwner);
@@ -100,7 +101,7 @@
broken = true;
}
- if (broken && log.isTraceEnabled())
+ if (broken && trace)
{
log.trace("Broke lock for node " + node.getFqn() +
" held by owner " + curOwner);
@@ -174,7 +175,7 @@
case Status.STATUS_UNKNOWN:
if (tryCount == 0)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Attempting to break transaction lock held " +
" by " + gtx + " by rolling back local tx");
@@ -223,7 +224,7 @@
if (tryCount == 0 && localTx)
{
// We can still abort the commit
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Attempting to break transaction lock held " +
"by " + gtx + " by marking local tx as " +
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -37,6 +37,7 @@
{
private static final Log log = LogFactory.getLog(WorkspaceNodeImpl.class);
+ private static final boolean trace = log.isTraceEnabled();
private NodeSPI<K, V> node;
private TransactionWorkspace workspace;
@@ -378,7 +379,7 @@
{
getChildrenAddedSet().add(child.getFqn());
if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
- if (log.isTraceEnabled()) log.trace("Adding child " + child.getFqn());
+ if (trace) log.trace("Adding child " + child.getFqn());
}
public void clearData()
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/GenericTransactionManagerLookup.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -30,7 +30,7 @@
public class GenericTransactionManagerLookup implements TransactionManagerLookup
{
- private static Log log = LogFactory.getLog(GenericTransactionManagerLookup.class);
+ private static final Log log = LogFactory.getLog(GenericTransactionManagerLookup.class);
/**
* JNDI lookups performed?
@@ -51,14 +51,14 @@
* JNDI locations for TransactionManagers we know of
*/
private static String[][] knownJNDIManagers =
- {
- {"java:/TransactionManager", "JBoss, JRun4"},
- {"java:comp/TransactionManager", "Resin 3.x"},
- {"java:pm/TransactionManager", "Borland, Sun"},
- {"java:appserver/TransactionManager", "Sun Glassfish"},
- {"javax.transaction.TransactionManager", "BEA WebLogic"},
- {"java:comp/UserTransaction", "Resin, Orion, JOnAS (JOTM)"},
- };
+ {
+ {"java:/TransactionManager", "JBoss, JRun4"},
+ {"java:comp/TransactionManager", "Resin 3.x"},
+ {"java:pm/TransactionManager", "Borland, Sun"},
+ {"java:appserver/TransactionManager", "Sun Glassfish"},
+ {"javax.transaction.TransactionManager", "BEA WebLogic"},
+ {"java:comp/UserTransaction", "Resin, Orion, JOnAS (JOTM)"},
+ };
/**
* WebSphere 5.1 and 6.0 TransactionManagerFactory
@@ -127,7 +127,7 @@
catch (NamingException e)
{
log.debug("Failed to perform a lookup for [" + knownJNDIManager[0] + " (" + knownJNDIManager[1]
- + ")]");
+ + ")]");
continue;
}
if (jndiObject instanceof TransactionManager)
@@ -179,7 +179,7 @@
catch (Exception ex)
{
log.error("Found WebSphere TransactionManager factory class [" + clazz.getName()
- + "], but couldn't invoke its static 'getTransactionManager' method", ex);
+ + "], but couldn't invoke its static 'getTransactionManager' method", ex);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -52,6 +52,7 @@
{
private static final Log log = LogFactory.getLog(TransactionEntry.class);
+ private static final boolean trace = log.isTraceEnabled();
/**
* Local transaction
@@ -209,7 +210,6 @@
public void releaseAllLocksLIFO(Object owner)
{
- boolean trace = log.isTraceEnabled();
synchronized (locks)
{
// Copying out to an array is faster than creating an ArrayList and iterating,
@@ -240,7 +240,7 @@
for (NodeLock lock : locks)
{
lock.release(owner);
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("releasing lock for " + lock.getFqn() + " (" + lock + ")");
}
@@ -314,7 +314,7 @@
*/
public void undoOperations()
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("undoOperations " + modificationList);
}
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -35,7 +35,7 @@
public class TransactionTable
{
private static final Log log = LogFactory.getLog(TransactionTable.class);
- private static boolean trace;
+ private static final boolean trace = log.isTraceEnabled();
/**
* Mapping between local (javax.transaction.Transaction)
@@ -61,7 +61,6 @@
this.transactionManager = transactionManager;
this.rpcManager = rpcManager;
isOptimisticLocking = configuration.isNodeLockingOptimistic();
- trace = log.isTraceEnabled();
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/util/BeanUtils.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/BeanUtils.java 2008-04-30 14:04:04 UTC (rev 5771)
+++ core/trunk/src/main/java/org/jboss/cache/util/BeanUtils.java 2008-04-30 14:29:13 UTC (rev 5772)
@@ -1,8 +1,5 @@
package org.jboss.cache.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.lang.reflect.Method;
import java.util.Locale;
@@ -14,8 +11,6 @@
*/
public class BeanUtils
{
- private static Log log = LogFactory.getLog(BeanUtils.class);
-
/**
* Retrieves a setter name based on a field name passed in
*
16 years, 8 months
JBoss Cache SVN: r5771 - core/trunk/src/test/java/org/jboss/cache/profiling.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 10:04:04 -0400 (Wed, 30 Apr 2008)
New Revision: 5771
Modified:
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
Log:
Improved profiling tests
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-04-30 12:17:13 UTC (rev 5770)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2008-04-30 14:04:04 UTC (rev 5771)
@@ -41,4 +41,12 @@
public abstract void testReplSyncOptBR() throws Exception;
public abstract void testReplAsyncOptBR() throws Exception;
+
+ public abstract void testStateTransfer() throws Exception;
+
+ public abstract void testStartup() throws Exception;
+
+ public abstract void testCacheLoading() throws Exception;
+
+ public abstract void testPassivation() throws Exception;
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-04-30 12:17:13 UTC (rev 5770)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileSlaveTest.java 2008-04-30 14:04:04 UTC (rev 5771)
@@ -82,4 +82,28 @@
cache.getConfiguration().setBuddyReplicationConfig(brc);
testReplAsyncOptimistic();
}
+
+ public void testStateTransfer() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testStartup() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testCacheLoading() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testPassivation() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-04-30 12:17:13 UTC (rev 5770)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/ProfileTest.java 2008-04-30 14:04:04 UTC (rev 5771)
@@ -36,12 +36,12 @@
/*
Test configuration options
*/
- protected static final long DURATION = 5 * 60 * 1000;
- protected static final int NUM_THREADS = 5;
- protected static final int MAX_RANDOM_SLEEP_MILLIS = 50;
- protected static final int MAX_DEPTH = 4;
- protected static final int MAX_OVERALL_NODES = 100;
- protected static final int WARMUP_LOOPS = 10000;
+ protected static final long DURATION = 10 * 60 * 1000; // 15 mins
+ protected static final int NUM_THREADS = 15;
+ protected static final int MAX_RANDOM_SLEEP_MILLIS = 25;
+ protected static final int MAX_DEPTH = 3;
+ protected static final int MAX_OVERALL_NODES = 200;
+ protected static final int WARMUP_LOOPS = 20000;
private List<Fqn> fqns = new ArrayList<Fqn>(MAX_OVERALL_NODES);
private Random r = new Random();
@@ -163,28 +163,45 @@
log.warn("Started cache. " + printDuration(duration));
}
- private void warmup()
+ private void warmup() throws InterruptedException
{
long startTime = System.currentTimeMillis();
+ ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
log.warn("Starting warmup");
// creates all the Fqns since this can be expensive and we don't really want to measure this (for now)
- for (Fqn f : fqns)
+ for (final Fqn f : fqns)
{
- // this will create the necessary nodes.
- cache.put(f, Collections.emptyMap());
+ exec.execute(new Runnable()
+ {
+ public void run()
+ {
+ // this will create the necessary nodes.
+ cache.put(f, Collections.emptyMap());
+ }
+ });
}
// loop through WARMUP_LOOPS gets and puts for JVM optimisation
for (int i = 0; i < WARMUP_LOOPS; i++)
{
- Fqn f = fqns.get(r.nextInt(MAX_OVERALL_NODES));
- cache.get(f, "");
- cache.put(f, "k", "v");
- cache.remove(f, "k");
+ exec.execute(new Runnable()
+ {
+ public void run()
+ {
+ Fqn f = fqns.get(r.nextInt(MAX_OVERALL_NODES));
+ cache.get(f, "");
+ cache.put(f, "k", "v");
+ cache.remove(f, "k");
+ }
+ });
}
+ exec.shutdown();
+ exec.awaitTermination(360, TimeUnit.SECONDS);
+
long duration = System.currentTimeMillis() - startTime;
log.warn("Finished warmup. " + printDuration(duration));
+ cache.removeNode(Fqn.ROOT);
}
private void doTest() throws Exception
@@ -196,35 +213,87 @@
int i = 0;
while (System.currentTimeMillis() < end)
{
- exec.execute(new MyRunnable(i++));
+ MyRunnable r = null;
+ switch (i % 3)
+ {
+ case 0:
+ r = new Putter(i++);
+ break;
+ case 1:
+ r = new Getter(i++);
+ break;
+ case 2:
+ r = new Remover(i++);
+ break;
+ }
+ exec.execute(r);
TestingUtil.sleepRandom(MAX_RANDOM_SLEEP_MILLIS);
}
log.warn("Finished generating runnables; awaiting executor completion");
// wait for executors to complete!
exec.shutdown();
- exec.awaitTermination(10000, TimeUnit.MILLISECONDS);
+ exec.awaitTermination(((long) i) * 250, TimeUnit.MILLISECONDS); // wait up to 250 millis for each call?
long duration = System.currentTimeMillis() - startTime;
log.warn("Finished test. " + printDuration(duration));
}
- private class MyRunnable implements Runnable
+ enum Mode
{
+ PUT, GET, REMOVE
+ }
+
+ private abstract class MyRunnable implements Runnable
+ {
int id;
+ Mode mode;
- private MyRunnable(int id)
+ public void run()
{
+ if (id % 100 == 0) log.warn("Processing iteration " + id);
+ String k = getRandomString();
+ Fqn f = fqns.get(r.nextInt(MAX_OVERALL_NODES));
+ switch (mode)
+ {
+ case PUT:
+ cache.put(f, k, getRandomString());
+ break;
+ case GET:
+ cache.get(f, k);
+ break;
+ case REMOVE:
+ cache.remove(f, k);
+ break;
+ }
+ }
+ }
+
+ private class Putter extends MyRunnable
+ {
+ private Putter(int id)
+ {
this.id = id;
+ mode = Mode.PUT;
}
+ }
- public void run()
+ private class Getter extends MyRunnable
+ {
+ private Getter(int id)
{
- if (id % 100 == 0) log.warn("Processing iteration " + id);
- String k = getRandomString();
- String v = getRandomString();
- cache.put(fqns.get(r.nextInt(MAX_OVERALL_NODES)), k, v);
+ this.id = id;
+ mode = Mode.GET;
}
}
+ private class Remover extends MyRunnable
+ {
+ private Remover(int id)
+ {
+ this.id = id;
+ mode = Mode.REMOVE;
+ }
+ }
+
private String getRandomString()
{
StringBuilder sb = new StringBuilder();
@@ -249,4 +318,28 @@
return "Duration: " + duration + " millis";
}
}
+
+ public void testStateTransfer() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testStartup() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testCacheLoading() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
+
+ public void testPassivation() throws Exception
+ {
+ // TODO implement me
+ throw new Exception("Implement me");
+ }
}
16 years, 8 months
JBoss Cache SVN: r5770 - in core/trunk/src/main/java/org/jboss/cache/commands: remote and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-04-30 08:17:13 -0400 (Wed, 30 Apr 2008)
New Revision: 5770
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
Log:
performance improvement - cache trace level
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -22,7 +22,7 @@
{
public static final int METHOD_ID = 26;
private static final Log log = LogFactory.getLog(GetKeyValueCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
private Notifier notifier;
private Object key;
@@ -30,12 +30,10 @@
public GetKeyValueCommand()
{
- trace = log.isTraceEnabled();
}
public GetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
{
- this();
this.fqn = fqn;
this.key = key;
this.sendNodeEvent = sendNodeEvent;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -41,16 +41,14 @@
private boolean searchSubtrees;
private static final Log log = LogFactory.getLog(GravitateDataCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
public GravitateDataCommand()
{
- trace = log.isTraceEnabled();
}
public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
{
- this();
this.fqn = fqn;
this.searchSubtrees = searchSubtrees;
}
@@ -120,8 +118,7 @@
// break out of the inner loop searching through the dead node's various backups
if (actualNode != null) break;
}
- }
- else
+ } else
{
backupNodeFqn = Fqn.fromRelativeFqn(backupRoot, fqn);
// use a get() call into the cache to make sure cache loading takes place.
@@ -143,8 +140,7 @@
if (actualNode == null)
{
return GravitateResult.noDataFound();
- }
- else
+ } else
{
// make sure we LOAD data for this node!!
actualNode.getData();
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -34,16 +34,14 @@
private InterceptorChain interceptorChain;
private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
public ClusteredGetCommand()
{
- trace = log.isTraceEnabled();
}
public ClusteredGetCommand(Boolean searchBackupSubtrees, DataCommand dataCommand)
{
- this();
this.searchBackupSubtrees = searchBackupSubtrees;
this.dataCommand = dataCommand;
}
@@ -88,8 +86,7 @@
{
results.add(true);
results.add(callResults);
- }
- else
+ } else
{
results.add(false);
results.add(null);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -39,7 +39,7 @@
private DataContainer dataContainer;
private static final Log log = LogFactory.getLog(DataGravitationCleanupCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/* parameters */
private GlobalTransaction globalTransaction;
@@ -49,12 +49,10 @@
public DataGravitationCleanupCommand()
{
- trace = log.isTraceEnabled();
}
public DataGravitationCleanupCommand(Fqn primary, Fqn backup)
{
- this();
this.fqn = primary;
this.backup = backup;
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -31,7 +31,7 @@
private InterceptorChain invoker;
private static final Log log = LogFactory.getLog(ReplicateCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/**
* optimisation - rather than constructing a new list each for scenarios where a single modification needs
@@ -42,12 +42,10 @@
public ReplicateCommand()
{
- trace = log.isTraceEnabled();
}
public ReplicateCommand(List<ReplicableCommand> modifications)
{
- this();
if (modifications != null && modifications.size() == 1)
{
singleModification = modifications.get(0);
@@ -123,13 +121,11 @@
if (returnValueForRemoteCall(cacheCommand))
{
result = retVal;
- }
- else
+ } else
{
result = null;
}
- }
- else
+ } else
{
result = cacheCommand.perform(null);
}
@@ -139,8 +135,7 @@
if (!isPutForExternalRead(cacheCommand))
{
throw ex;
- }
- else
+ } else
{
if (trace)
log.trace("Caught an exception, but since this is a putForExternalRead() call, suppressing the exception. Exception is:", ex);
@@ -191,8 +186,7 @@
if (commandId == SINGLE_METHOD_ID)
{
singleModification = (ReplicableCommand) args[0];
- }
- else
+ } else
{
modifications = (List<ReplicableCommand>) args[0];
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -36,7 +36,7 @@
{
public static final int METHOD_ID = 47;
private static final Log log = LogFactory.getLog(InvalidateCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/* dependencies*/
private boolean isOptimisticLocking;
@@ -46,13 +46,11 @@
public InvalidateCommand()
{
super(null);
- trace = log.isTraceEnabled();
}
public InvalidateCommand(Fqn fqn)
{
super(fqn);
- trace = log.isTraceEnabled();
}
@Inject
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -24,8 +24,8 @@
{
public static final int METHOD_ID = 36;
private static final Log log = LogFactory.getLog(MoveCommand.class);
- private static boolean trace;
-
+ private static boolean trace = log.isTraceEnabled();
+
/* params */
private Fqn to;
private Notifier notifier;
@@ -35,7 +35,6 @@
public void injectNotifier(Notifier notifier)
{
this.notifier = notifier;
- trace = log.isTraceEnabled();
}
public MoveCommand()
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -28,8 +28,7 @@
public static final int ERASE_VERSIONED_METHOD_ID = 38;
private static final Log log = LogFactory.getLog(PutDataMapCommand.class);
- private static boolean trace;
-
+ private static boolean trace = log.isTraceEnabled();
/* parameters*/
private Map data;
boolean createUndoOps;
@@ -38,7 +37,6 @@
public PutDataMapCommand()
{
- trace = log.isTraceEnabled();
}
public PutDataMapCommand(GlobalTransaction globalTransaction, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContents)
@@ -121,8 +119,7 @@
if (isVersioned())
{
return eraseContents ? ERASE_VERSIONED_METHOD_ID : VERSIONED_METHOD_ID;
- }
- else
+ } else
{
return eraseContents ? ERASE_METHOD_ID : METHOD_ID;
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -25,7 +25,7 @@
public static final int VERSIONED_METHOD_ID = 42;
private static final Log log = LogFactory.getLog(RemoveDataCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/* parameters*/
private boolean createUndoops;
@@ -35,12 +35,10 @@
public RemoveDataCommand()
{
- trace = log.isTraceEnabled();
}
public RemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
{
- this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.createUndoops = createUndoops;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -25,7 +25,7 @@
public static final int VERSIONED_METHOD_ID = 41;
private static final Log log = LogFactory.getLog(RemoveKeyCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/* parameters */
private Object key;
@@ -34,7 +34,6 @@
public RemoveKeyCommand()
{
- trace = log.isTraceEnabled();
}
public RemoveKeyCommand(GlobalTransaction gtx, Fqn fqn, Object key, boolean createUndoOps)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-30 12:17:13 UTC (rev 5770)
@@ -23,7 +23,7 @@
public static final int METHOD_ID = 5;
public static final int VERSIONED_METHOD_ID = 40;
private static final Log log = LogFactory.getLog(RemoveNodeCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/*parameters*/
private boolean createUndoOps;
@@ -35,7 +35,6 @@
public RemoveNodeCommand()
{
- trace = log.isTraceEnabled();
}
public RemoveNodeCommand(GlobalTransaction globalTransaction, Fqn fqn, boolean createUndoOps, boolean skipSendingNodeEvents, boolean eviction)
16 years, 8 months
JBoss Cache SVN: r5769 - in core/trunk/src/main/java/org/jboss/cache: commands/write and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 08:00:36 -0400 (Wed, 30 Apr 2008)
New Revision: 5769
Modified:
core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
Log:
Refactoring
Modified: core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -28,6 +28,7 @@
public class InvocationContext implements Cloneable
{
private static final Log log = LogFactory.getLog(InvocationContext.class);
+ private static final boolean trace = log.isTraceEnabled();
private Transaction transaction;
private GlobalTransaction globalTransaction;
@@ -196,7 +197,7 @@
if (!isValidTransaction())
{ // no TX
List<NodeLock> locks = getInvocationLocksAcquired();
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Attempting to release locks on current thread. Locks for the invocation is " + locks);
if (locks != null && locks.size() > 0)
@@ -208,7 +209,7 @@
for (int i = locks.size() - 1; i > -1; i--)
{
NodeLock nl = locks.get(i);
- if (log.isTraceEnabled()) log.trace("releasing lock for " + nl.getFqn() + ": " + nl);
+ if (trace) log.trace("releasing lock for " + nl.getFqn() + ": " + nl);
nl.release(currentThread);
}
}
@@ -461,7 +462,7 @@
boolean shouldRethtrow = optionOverride == null || !optionOverride.isFailSilently();
if (!shouldRethtrow)
{
- if (log.isTraceEnabled())
+ if (trace)
log.trace("There was a problem handling this request, but failSilently was set, so suppressing exception", e);
return;
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -29,7 +29,7 @@
public static final int PUT_FOR_EXT_READ_VERSIONED_METHOD_ID = 46;
private static final Log log = LogFactory.getLog(PutKeyValueCommand.class);
- private static boolean trace;
+ private static boolean trace = log.isTraceEnabled();
/* parametres */
private Object key;
@@ -40,12 +40,10 @@
public PutKeyValueCommand()
{
- trace = log.isTraceEnabled();
}
public PutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
{
- this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.key = key;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -237,10 +237,7 @@
{
notifier.notifyNodeActivated(fqn, true, Collections.emptyMap(), ctx);
loader.remove(fqn);
- if (config.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- activations++;
- }
+ if (getStatisticsEnabled()) activations++;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -9,11 +9,11 @@
import org.jboss.cache.cluster.ReplicationQueue;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionEntry;
@@ -39,24 +39,26 @@
protected RPCManager rpcManager;
protected boolean defaultSynchronous;
- protected Configuration config;
@Inject
public void injectComponents(RPCManager rpcManager, BuddyManager buddyManager, ReplicationQueue replicationQueue,
- Configuration config, TransactionTable txTable, CommandsFactory commandsFactory)
+ TransactionTable txTable, CommandsFactory commandsFactory)
{
this.rpcManager = rpcManager;
this.replicationQueue = replicationQueue;
this.buddyManager = buddyManager;
-// usingBuddyReplication = buddyManager != null && buddyManager.isEnabled();
- usingBuddyReplication = config.getBuddyReplicationConfig() != null && config.getBuddyReplicationConfig().isEnabled();
- CacheMode mode = config.getCacheMode();
- defaultSynchronous = (mode == CacheMode.REPL_SYNC || mode == CacheMode.INVALIDATION_SYNC);
this.txTable = txTable;
- this.config = config;
this.commandsFactory = commandsFactory;
}
+ @Start
+ private void init()
+ {
+ usingBuddyReplication = configuration.getBuddyReplicationConfig() != null && configuration.getBuddyReplicationConfig().isEnabled();
+ CacheMode mode = configuration.getCacheMode();
+ defaultSynchronous = (mode == CacheMode.REPL_SYNC || mode == CacheMode.INVALIDATION_SYNC);
+ }
+
/**
* Checks whether any of the responses are exceptions. If yes, re-throws
* them (as exceptions or runtime exceptions).
@@ -90,7 +92,7 @@
protected void replicateCall(InvocationContext ctx, List<Address> recipients, ReplicableCommand c, boolean sync, Option o, boolean useOutOfBandMessage) throws Throwable
{
- long syncReplTimeout = config.getSyncReplTimeout();
+ long syncReplTimeout = configuration.getSyncReplTimeout();
// test for option overrides
if (o != null)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -53,7 +53,6 @@
private LockManager lockManager;
protected TransactionTable txTable = null;
- protected Configuration config;
protected CacheLoader loader;
protected DataContainer dataContainer;
protected Notifier notifier;
@@ -71,14 +70,13 @@
@Inject
protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm, Configuration configuration,
- DataContainer dataContainer, Configuration config, LockManager lockManager, Notifier notifier)
+ DataContainer dataContainer, LockManager lockManager, Notifier notifier)
{
this.txTable = txTable;
this.clm = clm;
CacheMode mode = configuration.getCacheMode();
usingOptimisticInvalidation = configuration.isNodeLockingOptimistic() && mode.isInvalidation();
this.dataContainer = dataContainer;
- this.config = config;
this.lockManager = lockManager;
this.notifier = notifier;
}
@@ -208,7 +206,7 @@
@Override
public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
{
- if (config.isNodeLockingOptimistic() && command.getFqn() != null)
+ if (configuration.isNodeLockingOptimistic() && command.getFqn() != null)
{
loadIfNeeded(ctx, command.getFqn(), null, false, false, false, txTable.get(ctx.getGlobalTransaction()), false, false, false);
}
@@ -367,7 +365,7 @@
}
// check this first!!!
- if (!n.isValid() && config.isNodeLockingOptimistic())
+ if (!n.isValid() && configuration.isNodeLockingOptimistic())
{
// attempt to load again; this only happens if we have tombstones lying around, or we are using invalidation.
if (trace) log.trace("loading again from cache loader since in-memory node is marked as invalid");
@@ -425,7 +423,7 @@
protected void lock(Fqn fqn, NodeLock.LockType lockType, boolean recursive, InvocationContext ctx) throws Throwable
{
- if (config.isNodeLockingOptimistic()) return;
+ if (configuration.isNodeLockingOptimistic()) return;
lockManager.acquireLocksWithTimeout(ctx, fqn, lockType, false, false, false, false, null, false);
if (recursive)
{
@@ -536,7 +534,7 @@
boolean nodeExists = (nodeData != null);
if (trace) log.trace("nodeExists " + nodeExists);
- if (config.getExposeManagementStatistics() && getStatisticsEnabled())
+ if (getStatisticsEnabled())
{
if (nodeExists)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -20,7 +20,6 @@
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor;
@@ -56,7 +55,6 @@
private Map<GlobalTransaction, Set<Fqn>> preparingTxs = new ConcurrentHashMap<GlobalTransaction, Set<Fqn>>();
private long cacheStores = 0;
private CacheLoader loader;
- private Configuration configuration;
private DataContainer dataContainer;
private CacheLoaderManager loaderManager;
@@ -67,14 +65,13 @@
}
@Inject
- protected void init(DataContainer dataContainer, CacheLoaderManager loaderManager, TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig, Configuration configuration)
+ protected void init(DataContainer dataContainer, CacheLoaderManager loaderManager, TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig)
{
// never inject a CacheLoader at this stage - only a CacheLoaderManager, since the CacheLoaderManager only creates a CacheLoader instance when it @Starts.
this.loaderManager = loaderManager;
this.loaderConfig = clConfig;
txMgr = txManager;
this.txTable = txTable;
- this.configuration = configuration;
this.dataContainer = dataContainer;
}
@@ -125,7 +122,7 @@
preparingTxs.remove(gtx);
throw t;
}
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
+ if (getStatisticsEnabled())
{
Integer puts = (Integer) txStores.get(gtx);
if (puts != null)
@@ -166,10 +163,7 @@
preparingTxs.remove(gtx);
loader.rollback(gtx);
}
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- txStores.remove(gtx);
- }
+ if (getStatisticsEnabled()) txStores.remove(gtx);
}
else
{
@@ -276,10 +270,8 @@
else
{
loader.put(command.getFqn(), command.getData());
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- cacheStores++;
- }
+ if (getStatisticsEnabled()) cacheStores++;
+
return returnValue;
}
}
@@ -294,10 +286,8 @@
return returnValue;
}
returnValue = loader.put(command.getFqn(), command.getKey(), command.getValue());
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- cacheStores++;
- }
+ if (getStatisticsEnabled()) cacheStores++;
+
return returnValue;
}
@@ -372,8 +362,7 @@
return;
}
if (trace) log.trace("Cache loader modification list: " + modifications);
- boolean statsEnabled = configuration.getExposeManagementStatistics() && getStatisticsEnabled();
- StoreModificationsBuilder modsBuilder = new StoreModificationsBuilder(statsEnabled);
+ StoreModificationsBuilder modsBuilder = new StoreModificationsBuilder(getStatisticsEnabled());
for (ReversibleCommand cacheCommand : modifications)
{
cacheCommand.acceptVisitor(null, modsBuilder);
@@ -387,7 +376,7 @@
loader.prepare(gtx, modsBuilder.modifications, onePhase);
preparingTxs.put(gtx, modsBuilder.affectedFqns);
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled() && modsBuilder.putCount > 0)
+ if (getStatisticsEnabled() && modsBuilder.putCount > 0)
{
txStores.put(gtx, modsBuilder.putCount);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -14,7 +14,6 @@
import org.jboss.cache.commands.write.RemoveDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
@@ -37,19 +36,13 @@
*/
public class CallInterceptor extends CommandInterceptor
{
-
- // private CacheLoaderManager cacheLoaderManager;
private TransactionTable transactionTable;
- private Configuration configuration;
private boolean cacheLoadingEnabled;
@Inject
- public void injectDependencies(TransactionTable transactionTable,
- Configuration configuration)
+ public void injectDependencies(TransactionTable transactionTable)
{
-// this.cacheLoaderManager = cacheLoaderManager;
this.transactionTable = transactionTable;
- this.configuration = configuration;
}
@Start
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -74,24 +74,22 @@
*/
private Map<GlobalTransaction, List<ReplicableCommand>> cleanupCommands = new ConcurrentHashMap<GlobalTransaction, List<ReplicableCommand>>();
private DataContainer dataContainer;
- private Configuration config;
private CommandsFactory commandsFactory;
private CacheSPI cacheSPI;
@Inject
- public void injectComponents(BuddyManager buddyManager, Configuration config, DataContainer dataContainer, CommandsFactory commandsFactory, CacheSPI cacheSPI)
+ public void injectComponents(BuddyManager buddyManager, DataContainer dataContainer, CommandsFactory commandsFactory, CacheSPI cacheSPI)
{
this.buddyManager = buddyManager;
this.dataContainer = dataContainer;
this.commandsFactory = commandsFactory;
this.cacheSPI = cacheSPI;
- this.config = config;
}
@Start
public void startInterceptor()
{
- syncCommunications = config.getCacheMode() == Configuration.CacheMode.REPL_SYNC || config.getCacheMode() == Configuration.CacheMode.INVALIDATION_SYNC;
+ syncCommunications = configuration.getCacheMode() == Configuration.CacheMode.REPL_SYNC || configuration.getCacheMode() == Configuration.CacheMode.INVALIDATION_SYNC;
}
@Override
@@ -341,7 +339,7 @@
break;
}
}
- else if (!config.isUseRegionBasedMarshalling())
+ else if (!configuration.isUseRegionBasedMarshalling())
{
// Null is OK if we are using region based marshalling; it
// is what is returned if a region is inactive. Otherwise
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -27,14 +27,10 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
-import java.util.Collections;
-import java.util.Map;
-
/**
* Class representing an interceptor.
*
@@ -47,8 +43,6 @@
{
protected CacheSPI<?, ?> cache;
protected Log log = null;
- protected Configuration configuration;
- private boolean statsEnabled = false;
protected boolean trace;
public void setCache(CacheSPI cache)
@@ -59,15 +53,13 @@
@Start
private void start()
{
- setStatisticsEnabled(configuration.getExposeManagementStatistics());
// for backward compatibility, this must only be done when the cache starts.
setCache(cache);
}
@Inject
- private void injectDependencies(CacheSPI cache, Configuration configuration)
+ private void injectDependencies(CacheSPI cache)
{
- this.configuration = configuration;
this.cache = cache;
}
@@ -83,6 +75,7 @@
/**
* Forwards the call to the nextInterceptor interceptor in the chain.
+ * This is here for backward compatibility.
*/
public Object nextInterceptor(InvocationContext ctx) throws Throwable
{
@@ -90,37 +83,6 @@
}
@Override
- public boolean getStatisticsEnabled()
- {
- return statsEnabled;
- }
-
- @Override
- public void setStatisticsEnabled(boolean enabled)
- {
- statsEnabled = enabled;
- }
-
- /**
- * This implementation returns an empty Map. If individual Interceptors wish to expose statistics, they can override this
- * method.
- */
- @Override
- public Map<String, Object> dumpStatistics()
- {
- return Collections.emptyMap();
- }
-
- /**
- * This implementation is a no-op. If individual Interceptors wish to expose statistics, they can override this
- * method.
- */
- @Override
- public void resetStatistics()
- {
- }
-
- @Override
public String toString()
{
return getClass().getName()
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -22,10 +22,10 @@
import org.jboss.cache.commands.write.RemoveDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.optimistic.TransactionWorkspace;
@@ -65,13 +65,18 @@
private CommandsFactory commandsFactory;
@Inject
- public void injectDependencies(Configuration config, CommandsFactory commandsFactory)
+ public void injectDependencies(CommandsFactory commandsFactory)
{
- optimistic = config.isNodeLockingOptimistic();
- if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction, List<ReversibleCommand>>();
this.commandsFactory = commandsFactory;
}
+ @Start
+ private void init()
+ {
+ optimistic = configuration.isNodeLockingOptimistic();
+ if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction, List<ReversibleCommand>>();
+ }
+
private boolean skipInvalidation(InvocationContext ctx)
{
Option optionOverride = ctx.getOptionOverrides();
@@ -242,7 +247,7 @@
{
try
{
- TransactionWorkspace workspace = config.isNodeLockingOptimistic() ? getWorkspace(gtx) : null;
+ TransactionWorkspace workspace = configuration.isNodeLockingOptimistic() ? getWorkspace(gtx) : null;
for (Fqn fqn : filterVisitor.result) invalidateAcrossCluster(fqn, workspace, defaultSynchronous, ctx);
}
catch (Throwable t)
@@ -366,8 +371,7 @@
private void incrementInvalidations()
{
- if (config.getExposeManagementStatistics() && getStatisticsEnabled())
- invalidations++;
+ if (getStatisticsEnabled()) invalidations++;
}
protected DataVersion getNodeVersion(TransactionWorkspace w, Fqn f)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -17,6 +17,7 @@
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -56,9 +57,14 @@
this.nodeFactory = nodeFactory;
this.dataContainer = dataContainer;
this.cache = cacheSPI;
- this.lockAcquisitionTimeout = cacheSPI.getConfiguration().getLockAcquisitionTimeout();
}
+ @Start
+ private void init()
+ {
+ lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
+ }
+
@Override
public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -13,8 +13,6 @@
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import static org.jboss.cache.lock.NodeLock.LockType.READ;
import static org.jboss.cache.lock.NodeLock.LockType.WRITE;
@@ -33,20 +31,13 @@
public class OptimisticLockingInterceptor extends OptimisticInterceptor
{
private long lockAcquisitionTimeout;
- private Configuration configuration;
- @Inject
- public void initialize(Configuration configuration)
- {
- this.configuration = configuration;
- lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
- }
-
@Start
- private void checkTransactionManager()
+ private void init()
{
if (txManager == null)
log.fatal("No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used! Expect errors!!");
+ lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -26,9 +26,9 @@
import org.jboss.cache.commands.write.RemoveDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.notifications.Notifier;
import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
@@ -63,15 +63,20 @@
@Inject
protected void injectDependencies(Notifier notifier, NodeFactory nodeFactory, CacheLoaderManager cacheLoaderManager,
- DataContainer dataContainer, Configuration configuration)
+ DataContainer dataContainer)
{
this.notifier = notifier;
this.nodeFactory = nodeFactory;
this.cacheLoaderManager = cacheLoaderManager;
this.dataContainer = dataContainer;
- this.lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
}
+ @Start
+ private void init()
+ {
+ lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
+ }
+
public OptimisticNodeInterceptor()
{
log = LogFactory.getLog(getClass());
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -62,13 +62,10 @@
private CommandsFactory commandsFactory;
- private Configuration configuration;
-
@Inject
- public void initialize(CommandsFactory commandsFactory, Configuration configuration)
+ public void initialize(CommandsFactory commandsFactory)
{
this.commandsFactory = commandsFactory;
- this.configuration = configuration;
}
private boolean isLocalOptionOverrides(InvocationContext ctx)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -7,7 +7,6 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -54,10 +53,15 @@
private DataContainer dataContainer;
@Inject
- public void initialize(CacheSPI cache, DataContainer dataContainer)
+ public void initialize(DataContainer dataContainer)
{
this.dataContainer = dataContainer;
- CacheMode mode = cache.getConfiguration().getCacheMode();
+ }
+
+ @Inject
+ private void init()
+ {
+ CacheMode mode = configuration.getCacheMode();
useTombstones = (mode == CacheMode.INVALIDATION_ASYNC) || (mode == CacheMode.INVALIDATION_SYNC);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -5,7 +5,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoader;
@@ -32,14 +31,12 @@
protected CacheLoader loader;
private Notifier notifier;
- private Configuration configuration;
private DataContainer dataContainer;
@Inject
- public void setDependencies(Notifier notifier, Configuration configuration, DataContainer dataContainer, CacheLoaderManager loaderManager)
+ public void setDependencies(Notifier notifier, DataContainer dataContainer, CacheLoaderManager loaderManager)
{
this.notifier = notifier;
- this.configuration = configuration;
this.dataContainer = dataContainer;
this.loader = loaderManager.getCacheLoader();
}
@@ -83,10 +80,7 @@
if (trace) log.trace("Passivating " + fqn);
loader.put(fqn, attributes);
notifier.notifyNodePassivated(fqn, false, Collections.emptyMap(), ctx);
- if (getStatisticsEnabled() && configuration.getExposeManagementStatistics())
- {
- passivations.getAndIncrement();
- }
+ if (getStatisticsEnabled()) passivations.getAndIncrement();
}
catch (NodeNotLoadedException e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -26,8 +26,8 @@
import org.jboss.cache.commands.write.RemoveDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.PostProcessingCommandInterceptor;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockManager;
@@ -61,19 +61,22 @@
private TransactionTable txTable;
private DataContainer dataContainer;
private LockManager lockManager;
- private Configuration configuration;
private long lockAcquisitionTimeout;
@Inject
- public void injectDependencies(Configuration configuration, DataContainer dataContainer, TransactionTable txTable, LockManager lockManager)
+ public void injectDependencies(DataContainer dataContainer, TransactionTable txTable, LockManager lockManager)
{
- lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
this.dataContainer = dataContainer;
this.txTable = txTable;
this.lockManager = lockManager;
- this.configuration = configuration;
}
+ @Start
+ private void init()
+ {
+ lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
+ }
+
@Override
public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -41,7 +41,7 @@
public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
{
if (!skipReplicationOfTransactionMethod(ctx))
- replicateCall(ctx, command, config.isSyncCommitPhase(), ctx.getOptionOverrides(), true);
+ replicateCall(ctx, command, configuration.isSyncCommitPhase(), ctx.getOptionOverrides(), true);
return invokeNextInterceptor(ctx, command);
}
@@ -58,7 +58,7 @@
{
if (!skipReplicationOfTransactionMethod(ctx) && !ctx.isLocalRollbackOnly())
{
- replicateCall(ctx, command, config.isSyncRollbackPhase(), ctx.getOptionOverrides());
+ replicateCall(ctx, command, configuration.isSyncRollbackPhase(), ctx.getOptionOverrides());
}
return invokeNextInterceptor(ctx, command);
}
@@ -127,8 +127,8 @@
if (trace)
{
log.trace("invoking method " + command.getClass().getSimpleName() + ", members=" + rpcManager.getMembers() + ", mode=" +
- config.getCacheMode() + ", exclude_self=" + true + ", timeout=" +
- config.getSyncReplTimeout());
+ configuration.getCacheMode() + ", exclude_self=" + true + ", timeout=" +
+ configuration.getSyncReplTimeout());
}
if (!isSynchronous(ctx.getOptionOverrides()) || forceAsync)
{
@@ -161,7 +161,7 @@
*/
protected void runPreparePhase(PrepareCommand prepareMethod, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
- boolean async = config.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
+ boolean async = configuration.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
if (trace)
{
log.trace("(" + rpcManager.getLocalAddress() + "): running remote prepare for global tx " + gtx + " with async mode=" + async);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -63,7 +63,6 @@
{
private final static Object NULL = new Object();
- private Configuration configuration;
private CommandsFactory commandsFactory;
private RPCManager rpcManager;
private Notifier notifier;
@@ -83,11 +82,10 @@
private long rollbacks = 0;
@Inject
- public void intialize(Configuration configuration, RPCManager rpcManager,
+ public void intialize(RPCManager rpcManager,
Notifier notifier, InvocationContextContainer icc,
LifecycleManager lifecycleManager, CommandsFactory factory)
{
- this.configuration = configuration;
this.commandsFactory = factory;
this.rpcManager = rpcManager;
this.notifier = notifier;
@@ -137,10 +135,7 @@
private void increasePrepares()
{
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- prepares++;
- }
+ if (getStatisticsEnabled()) prepares++;
}
@Override
@@ -729,18 +724,12 @@
private void increaseCommits()
{
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- commits++;
- }
+ if (getStatisticsEnabled()) commits++;
}
private void increaseRollbacks()
{
- if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
- {
- rollbacks++;
- }
+ if (getStatisticsEnabled()) rollbacks++;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -5,6 +5,9 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.AbstractVisitor;
import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.InterceptorMBean;
import java.util.Collections;
@@ -42,12 +45,26 @@
protected Log log;
protected boolean trace;
+ protected Configuration configuration;
+
public CommandInterceptor()
{
log = LogFactory.getLog(getClass());
trace = log.isTraceEnabled();
}
+ @Inject
+ private void injectConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ @Start
+ private void checkStatisticsUsed()
+ {
+ setStatisticsEnabled(configuration.getExposeManagementStatistics());
+ }
+
/**
* @return true if gathering statistics for JMX is enabled on this interceptor.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-04-30 08:11:48 UTC (rev 5768)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java 2008-04-30 12:00:36 UTC (rev 5769)
@@ -26,6 +26,7 @@
public class LockManager
{
private static Log log = LogFactory.getLog(LockManager.class);
+ private static final boolean trace = log.isTraceEnabled();
private Configuration configuration;
private long lockAcquisitionTimeout;
@@ -99,7 +100,7 @@
Object owner = (gtx != null) ? gtx : currentThread;
NodeSPI currentNode;
- if (log.isTraceEnabled()) log.trace("Attempting to lock node " + fqn + " for owner " + owner);
+ if (trace) log.trace("Attempting to lock node " + fqn + " for owner " + owner);
long expiryTime = System.currentTimeMillis() + timeout;
currentNode = rootNode;
NodeSPI parent = null;
@@ -116,12 +117,12 @@
// if the new node is to be marked as deleted, do not notify!
currentNode = parent.addChildDirect(childName, !skipNotification);
created = true;
- if (log.isTraceEnabled()) log.trace("Child node was null, so created child node " + childName);
+ if (trace) log.trace("Child node was null, so created child node " + childName);
if (createdNodes != null) createdNodes.add(currentNode);
}
else
{
- if (log.isTraceEnabled())
+ if (trace)
log.trace("failed to find or create child " + childName + " of node " + currentNode);
return false;
}
@@ -147,7 +148,7 @@
NodeSPI repeek = dataContainer.peek(currentNodeFqn, true, true);
if (currentNode != repeek)
{
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Was waiting for and obtained a lock on a node that doesn't exist anymore! Attempting lock acquisition again.");
// we have an orphan!! Lose the unnecessary lock and re-acquire the lock (and potentially recreate the node).
// check if the parent exists!!
@@ -156,7 +157,7 @@
if (parent == null || dataContainer.peek(parent.getFqn(), true, true) == null)
{
// crap!
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Parent has been deleted again. Go through the lock method all over again.");
currentNode = rootNode;
currentIndex = -1;
@@ -171,7 +172,7 @@
{
throw new TimeoutException("Unable to acquire lock on child node " + Fqn.fromRelativeElements(currentNode.getFqn(), childName) + " after " + timeout + " millis.");
}
- if (log.isTraceEnabled()) log.trace("Moving one level up, current node is :" + currentNode);
+ if (trace) log.trace("Moving one level up, current node is :" + currentNode);
}
}
else
16 years, 8 months
JBoss Cache SVN: r5768 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 8 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 04:11:48 -0400 (Wed, 30 Apr 2008)
New Revision: 5768
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionManager.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/config/BuddyReplicationConfig.java
core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/config/ConfigurationComponent.java
core/trunk/src/main/java/org/jboss/cache/config/EvictionConfig.java
core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java
core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java
core/trunk/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java
core/trunk/src/main/java/org/jboss/cache/util/Util.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
Log:
TODOs
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -719,16 +719,14 @@
// This region's state will no match that of a non-existent one
// So, there is no reason to keep this region any more
- // FIXME (Brian) We shouldn't do this anymore; now outside code
- // can have a ref to the region!!
+ // FIXME (Brian) We shouldn't do this anymore; now outside code can have a ref to the region!!
removeRegion(fqn);
}
else
{
//region.deactivate();
region.setActive(false);
- // FIXME - we should always clean up; otherwise stale data
- // is in memory!
+ // FIXME - we should always clean up; otherwise stale data is in memory!
if (cache.getConfiguration().isFetchInMemoryState())
{
inactivateRegion(fqn);
@@ -739,8 +737,7 @@
{
region = getRegion(fqn, true);
region.setActive(false);
- // FIXME - we should always clean up; otherwise stale data
- // is in memory!
+ // FIXME - we should always clean up; otherwise stale data is in memory!
if (cache.getConfiguration().isFetchInMemoryState())
{
inactivateRegion(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -558,10 +558,7 @@
o = cache.getInvocationContext().getOptionOverrides();
o.setCacheModeLocal(true);
o.setSkipCacheStatusCheck(true);
- // FIXME -- restore the next line and remove the following one
- // when JBCACHE-1265 is fixed
-// root.addChild(new Fqn<String>(BUDDY_BACKUP_SUBTREE, newGroup.getGroupName()));
- cache.put(integrationBase, null);
+ cache.getRoot().addChild(Fqn.fromElements(BUDDY_BACKUP_SUBTREE, newGroup.getGroupName()));
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -153,8 +153,6 @@
notifier.notifyNodeEvicted(fqn, true, ctx);
n.clearDataDirect();
n.setDataLoaded(false);
-
- // FIXME Bela did this so GUI view can refresh the view after node is evicted. But this breaks eviction policy, especially AOP!!!!
notifier.notifyNodeEvicted(fqn, false, ctx);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -92,7 +92,7 @@
notifier.notifyNodeVisited(fqn, false, ctx);
}
else
- {// FIXME Bela did this so GUI view can refresh the view after node is evicted. But this breaks eviction policy, especially AOP!!!!
+ {
if (eviction)
{
notifier.notifyNodeEvicted(fqn, false, ctx);
Modified: core/trunk/src/main/java/org/jboss/cache/config/BuddyReplicationConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/BuddyReplicationConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/BuddyReplicationConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -22,6 +22,7 @@
package org.jboss.cache.config;
import org.jboss.cache.buddyreplication.NextMemberBuddyLocator;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -139,8 +140,8 @@
&& (this.dataGravitationSearchBackupTrees == other.dataGravitationSearchBackupTrees)
&& (this.enabled == other.enabled)
&& (this.buddyCommunicationTimeout == other.buddyCommunicationTimeout)
- && safeEquals(this.buddyPoolName, other.buddyPoolName)
- && safeEquals(this.buddyLocatorConfig, other.buddyLocatorConfig);
+ && Util.safeEquals(this.buddyPoolName, other.buddyPoolName)
+ && Util.safeEquals(this.buddyLocatorConfig, other.buddyLocatorConfig);
}
return false;
@@ -209,8 +210,8 @@
if (obj instanceof BuddyLocatorConfig)
{
BuddyLocatorConfig other = (BuddyLocatorConfig) obj;
- return (safeEquals(this.buddyLocatorClass, other.buddyLocatorClass)
- && safeEquals(this.buddyLocatorProperties, other.buddyLocatorProperties));
+ return (Util.safeEquals(this.buddyLocatorClass, other.buddyLocatorClass)
+ && Util.safeEquals(this.buddyLocatorProperties, other.buddyLocatorProperties));
}
return false;
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/CacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -8,6 +8,7 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.SingletonStoreCacheLoader;
+import org.jboss.cache.util.Util;
import org.jboss.cache.xml.XmlHelper;
import java.io.ByteArrayInputStream;
@@ -116,8 +117,8 @@
CacheLoaderConfig other = (CacheLoaderConfig) obj;
return (this.passivation == other.passivation)
&& (this.shared == other.shared)
- && safeEquals(this.preload, other.preload)
- && safeEquals(this.cacheLoaderConfigs, other.cacheLoaderConfigs);
+ && Util.safeEquals(this.preload, other.preload)
+ && Util.safeEquals(this.cacheLoaderConfigs, other.cacheLoaderConfigs);
}
return false;
}
@@ -321,7 +322,7 @@
return false;
IndividualCacheLoaderConfig i = (IndividualCacheLoaderConfig) obj;
return equalsExcludingProperties(i)
- && safeEquals(this.properties, i.properties);
+ && Util.safeEquals(this.properties, i.properties);
}
protected boolean equalsExcludingProperties(Object obj)
@@ -330,11 +331,11 @@
return false;
IndividualCacheLoaderConfig other = (IndividualCacheLoaderConfig) obj;
- return safeEquals(this.className, other.className)
+ return Util.safeEquals(this.className, other.className)
&& (this.async == other.async)
&& (this.ignoreModifications == other.ignoreModifications)
&& (this.fetchPersistentState == other.fetchPersistentState)
- && safeEquals(this.singletonStoreConfig, other.singletonStoreConfig);
+ && Util.safeEquals(this.singletonStoreConfig, other.singletonStoreConfig);
}
@@ -454,8 +455,8 @@
{
SingletonStoreConfig other = (SingletonStoreConfig) obj;
return ((this.singletonStoreEnabled == other.singletonStoreEnabled)
- && safeEquals(this.singletonStoreClass, other.singletonStoreClass)
- && safeEquals(this.singletonStoreproperties, other.singletonStoreproperties));
+ && Util.safeEquals(this.singletonStoreClass, other.singletonStoreClass)
+ && Util.safeEquals(this.singletonStoreproperties, other.singletonStoreproperties));
}
return false;
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/ConfigurationComponent.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/ConfigurationComponent.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/ConfigurationComponent.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -156,14 +156,4 @@
c.setCache(null);
return c;
}
-
- /**
- * Null-safe equality test.
- * <p/>
- * FIXME this must be written elsewhere.
- */
- protected static boolean safeEquals(Object a, Object b)
- {
- return (a == b) || (a != null && a.equals(b));
- }
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/EvictionConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/EvictionConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/EvictionConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -21,14 +21,12 @@
*/
package org.jboss.cache.config;
-import org.jboss.cache.Fqn;
import org.jboss.cache.RegionManager;
import org.jboss.cache.eviction.EvictionPolicy;
+import org.jboss.cache.util.Util;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
public class EvictionConfig extends ConfigurationComponent
{
@@ -69,7 +67,7 @@
public boolean isValidConfig()
{
return (defaultEvictionPolicyClass != null && defaultEvictionPolicyClass.length() > 0)
- || (evictionRegionConfigs != null && evictionRegionConfigs.size() > 0);
+ || (evictionRegionConfigs != null && evictionRegionConfigs.size() > 0);
}
public String getDefaultEvictionPolicyClass()
@@ -82,22 +80,21 @@
testImmutability("defaultEvictionPolicyClass");
this.defaultEvictionPolicyClass = defaultEvictionPolicyClass;
}
-
+
/**
- * Creates an EvictionRegionConfig for the
- * {@link RegionManager.DEFAULT_REGION "_default_"} region using the
- * {@link #getDefaultEvictionPolicyClass(String) default eviction policy class}. Throws a
- * {@link ConfigurationException} if
- * {@link #setDefaultEvictionPolicyClass(String) a default eviction policy class}
+ * Creates an EvictionRegionConfig for the
+ * {@link RegionManager.DEFAULT_REGION "_default_"} region using the
+ * {@link #getDefaultEvictionPolicyClass(String) default eviction policy class}. Throws a
+ * {@link ConfigurationException} if
+ * {@link #setDefaultEvictionPolicyClass(String) a default eviction policy class}
* has not been set.
- *
+ *
* @return an EvictionRegionConfig whose FQN is {@link RegionManager.DEFAULT_REGION}
* and whose EvictionPolicyConfig is the default config for the
* default eviction policy class.
- *
- * @throws ConfigurationException if a
- * {@link #setDefaultEvictionPolicyClass(String) a default eviction policy class}
- * has not been set or there is a problem instantiating the configuration.
+ * @throws ConfigurationException if a
+ * {@link #setDefaultEvictionPolicyClass(String) a default eviction policy class}
+ * has not been set or there is a problem instantiating the configuration.
*/
public EvictionRegionConfig createDefaultEvictionRegionConfig()
{
@@ -128,7 +125,7 @@
public List<EvictionRegionConfig> getEvictionRegionConfigs()
{
if (evictionRegionConfigs == null)
- {
+ {
return new ArrayList<EvictionRegionConfig>(1);
}
return evictionRegionConfigs;
@@ -181,8 +178,8 @@
{
EvictionConfig other = (EvictionConfig) obj;
return (this.wakeupIntervalSeconds == other.wakeupIntervalSeconds)
- && safeEquals(this.defaultEvictionPolicyClass, other.defaultEvictionPolicyClass)
- && safeEquals(this.evictionRegionConfigs, other.evictionRegionConfigs);
+ && Util.safeEquals(this.defaultEvictionPolicyClass, other.defaultEvictionPolicyClass)
+ && Util.safeEquals(this.evictionRegionConfigs, other.evictionRegionConfigs);
}
return false;
}
@@ -206,12 +203,12 @@
List<EvictionRegionConfig> ercs = new ArrayList<EvictionRegionConfig>(evictionRegionConfigs.size());
for (EvictionRegionConfig erc : evictionRegionConfigs)
{
- ercs.add(erc.clone());
+ ercs.add(erc.clone());
}
clone.setEvictionRegionConfigs(ercs);
}
return clone;
}
-
-
+
+
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/EvictionRegionConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -23,6 +23,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.util.Util;
import java.lang.reflect.Method;
@@ -130,7 +131,7 @@
if (obj instanceof EvictionRegionConfig)
{
EvictionRegionConfig other = (EvictionRegionConfig) obj;
- return safeEquals(this.regionFqn, other.regionFqn);
+ return Util.safeEquals(this.regionFqn, other.regionFqn);
}
return false;
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/config/RuntimeConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -9,6 +9,7 @@
import org.jboss.cache.NodeFactory;
import org.jboss.cache.RPCManager;
import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.util.Util;
import org.jgroups.Channel;
import org.jgroups.ChannelFactory;
@@ -150,10 +151,10 @@
if (obj instanceof RuntimeConfig)
{
RuntimeConfig other = (RuntimeConfig) obj;
- return safeEquals(transactionManager, other.transactionManager)
- && safeEquals(muxChannelFactory, other.muxChannelFactory)
- && safeEquals(rpcManager, other.rpcManager)
- && safeEquals(channel, other.channel);
+ return Util.safeEquals(transactionManager, other.transactionManager)
+ && Util.safeEquals(muxChannelFactory, other.muxChannelFactory)
+ && Util.safeEquals(rpcManager, other.rpcManager)
+ && Util.safeEquals(channel, other.channel);
}
return false;
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -4,6 +4,7 @@
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.Dynamic;
import org.jboss.cache.config.EvictionPolicyConfig;
+import org.jboss.cache.util.Util;
/**
* Base implementation of {@link EvictionPolicyConfig}. Adds properties
@@ -11,13 +12,15 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
-public abstract class EvictionPolicyConfigBase
- extends ConfigurationComponent
- implements EvictionPolicyConfig
+public abstract class EvictionPolicyConfigBase
+ extends ConfigurationComponent
+ implements EvictionPolicyConfig
{
- /** The serialVersionUID */
+ /**
+ * The serialVersionUID
+ */
private static final long serialVersionUID = 4591691674370188932L;
-
+
private String evictionPolicyClass;
@Dynamic
private int maxNodes = 0;
@@ -27,10 +30,10 @@
/**
* Can only be instantiated by a subclass.
- *
+ * <p/>
* Calls {@link #setEvictionPolicyClassName()}.
*/
- protected EvictionPolicyConfigBase()
+ protected EvictionPolicyConfigBase()
{
setEvictionPolicyClassName();
}
@@ -39,7 +42,7 @@
{
return evictionPolicyClass;
}
-
+
public void setEvictionPolicyClass(String evictionPolicyClass)
{
testImmutability("evictionPolicyClass");
@@ -50,7 +53,7 @@
{
return maxNodes;
}
-
+
public void setMaxNodes(int maxNodes)
{
testImmutability("maxNodes");
@@ -66,7 +69,7 @@
{
this.minTimeToLiveSeconds = minTimeToLiveSeconds;
}
-
+
public void validate() throws ConfigurationException
{
// no-op
@@ -77,15 +80,15 @@
{
if (this == obj)
return true;
-
+
if (obj instanceof EvictionPolicyConfigBase)
{
EvictionPolicyConfigBase other = (EvictionPolicyConfigBase) obj;
-
+
return this.maxNodes == other.maxNodes && this.minTimeToLiveSeconds == other.minTimeToLiveSeconds
- && safeEquals(this.evictionPolicyClass, other.evictionPolicyClass);
+ && Util.safeEquals(this.evictionPolicyClass, other.evictionPolicyClass);
}
-
+
return false;
}
@@ -98,7 +101,7 @@
result = 31 * result + (evictionPolicyClass == null ? 0 : evictionPolicyClass.hashCode());
return result;
}
-
+
public void reset()
{
setEvictionPolicyClass(null);
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -1,6 +1,7 @@
package org.jboss.cache.loader;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -346,24 +347,24 @@
AdjListJDBCCacheLoaderConfig other = (AdjListJDBCCacheLoaderConfig) obj;
return (this.createTable == other.createTable)
- && safeEquals(createTableDDL, other.createTableDDL)
- && safeEquals(datasourceName, other.datasourceName)
- && safeEquals(deleteAllSql, other.deleteAllSql)
- && safeEquals(deleteNodeSql, other.deleteNodeSql)
- && safeEquals(driverClass, other.driverClass)
+ && Util.safeEquals(createTableDDL, other.createTableDDL)
+ && Util.safeEquals(datasourceName, other.datasourceName)
+ && Util.safeEquals(deleteAllSql, other.deleteAllSql)
+ && Util.safeEquals(deleteNodeSql, other.deleteNodeSql)
+ && Util.safeEquals(driverClass, other.driverClass)
&& (dropTable == other.dropTable)
- && safeEquals(dropTableDDL, other.dropTableDDL)
- && safeEquals(insertNodeSql, other.insertNodeSql)
- && safeEquals(jdbcPassword, other.jdbcPassword)
- && safeEquals(jdbcURL, other.jdbcURL)
- && safeEquals(jdbcUser, other.jdbcUser)
- && safeEquals(selectChildFqnsSql, other.selectChildFqnsSql)
- && safeEquals(selectChildNamesSql, other.selectChildNamesSql)
- && safeEquals(selectNodeSql, other.selectNodeSql)
- && safeEquals(table, other.table)
- && safeEquals(updateNodeSql, other.updateNodeSql)
- && safeEquals(updateTableSql, other.updateTableSql)
- && safeEquals(connectionFactoryClass, other.connectionFactoryClass);
+ && Util.safeEquals(dropTableDDL, other.dropTableDDL)
+ && Util.safeEquals(insertNodeSql, other.insertNodeSql)
+ && Util.safeEquals(jdbcPassword, other.jdbcPassword)
+ && Util.safeEquals(jdbcURL, other.jdbcURL)
+ && Util.safeEquals(jdbcUser, other.jdbcUser)
+ && Util.safeEquals(selectChildFqnsSql, other.selectChildFqnsSql)
+ && Util.safeEquals(selectChildNamesSql, other.selectChildNamesSql)
+ && Util.safeEquals(selectNodeSql, other.selectNodeSql)
+ && Util.safeEquals(table, other.table)
+ && Util.safeEquals(updateNodeSql, other.updateNodeSql)
+ && Util.safeEquals(updateTableSql, other.updateTableSql)
+ && Util.safeEquals(connectionFactoryClass, other.connectionFactoryClass);
}
return false;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -2,6 +2,7 @@
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.Dynamic;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -69,7 +70,7 @@
{
if (obj instanceof FileCacheLoaderConfig && equalsExcludingProperties(obj))
{
- return safeEquals(location, ((FileCacheLoaderConfig) obj).location);
+ return Util.safeEquals(location, ((FileCacheLoaderConfig) obj).location);
}
return false;
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -1,6 +1,7 @@
package org.jboss.cache.loader;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -126,7 +127,7 @@
{
TcpDelegatingCacheLoaderConfig other = (TcpDelegatingCacheLoaderConfig) obj;
- return safeEquals(host, other.host)
+ return Util.safeEquals(host, other.host)
&& (port == other.port) && (timeout == other.timeout) && (reconnectWaitTime == other.reconnectWaitTime);
}
return false;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -1,6 +1,7 @@
package org.jboss.cache.loader.bdbje;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -49,7 +50,7 @@
{
if (obj instanceof BdbjeCacheLoaderConfig && equalsExcludingProperties(obj))
{
- return safeEquals(location, ((BdbjeCacheLoaderConfig) obj).location);
+ return Util.safeEquals(location, ((BdbjeCacheLoaderConfig) obj).location);
}
return false;
}
@@ -65,7 +66,6 @@
{
return (BdbjeCacheLoaderConfig) super.clone();
}
-
-
+
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -1,6 +1,7 @@
package org.jboss.cache.loader.jdbm;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.util.Util;
import java.util.Properties;
@@ -49,7 +50,7 @@
{
if (obj instanceof JdbmCacheLoaderConfig && equalsExcludingProperties(obj))
{
- return safeEquals(location, ((JdbmCacheLoaderConfig) obj).location);
+ return Util.safeEquals(location, ((JdbmCacheLoaderConfig) obj).location);
}
return false;
}
Modified: core/trunk/src/main/java/org/jboss/cache/util/Util.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/Util.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/main/java/org/jboss/cache/util/Util.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -104,6 +104,18 @@
}
/**
+ * Null-safe equality test.
+ *
+ * @param a first object to compare
+ * @param b second object to compare
+ * @return true if the objects are equals or both null, false otherwise.
+ */
+ public static boolean safeEquals(Object a, Object b)
+ {
+ return (a == b) || (a != null && a.equals(b));
+ }
+
+ /**
* Static inner class that holds 3 maps - for data added, removed and modified.
*/
public static class MapModifications
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java 2008-04-30 07:46:37 UTC (rev 5767)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java 2008-04-30 08:11:48 UTC (rev 5768)
@@ -93,8 +93,7 @@
Fqn fqnA = Fqn.fromString("/a");
Fqn fqnD = Fqn.fromString("/d");
- // FIXME We have to use a hack to get JBC to recognize that our
- // regions are for marshalling
+ // FIXME We have to use a hack to get JBC to recognize that our regions are for marshalling
ClassLoader cl = Fqn.class.getClassLoader();
caches.get(0).getRegion(fqnA, true).registerContextClassLoader(cl);
caches.get(1).getRegion(fqnA, true).registerContextClassLoader(cl);
16 years, 8 months
JBoss Cache SVN: r5767 - in core/tags/2.1.1.GA: src/main/java/org/jboss/cache and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 03:46:37 -0400 (Wed, 30 Apr 2008)
New Revision: 5767
Modified:
core/tags/2.1.1.GA/pom.xml
core/tags/2.1.1.GA/src/main/java/org/jboss/cache/Version.java
Log:
Updated version
Modified: core/tags/2.1.1.GA/pom.xml
===================================================================
--- core/tags/2.1.1.GA/pom.xml 2008-04-30 07:25:15 UTC (rev 5766)
+++ core/tags/2.1.1.GA/pom.xml 2008-04-30 07:46:37 UTC (rev 5767)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>2.1.1-SNAPSHOT</jbosscache-core-version>
+ <jbosscache-core-version>2.1.1.GA</jbosscache-core-version>
</properties>
<parent>
<groupId>org.jboss.cache</groupId>
@@ -170,12 +170,12 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0.Beta1</version>
<type>jdocbook-style</type>
</dependency>
<dependency>
@@ -342,7 +342,7 @@
<activeByDefault>false</activeByDefault>
</activation>
<properties>
- <jbosscache-core-version>2.1.1-SNAPSHOT-JBossAS</jbosscache-core-version>
+ <jbosscache-core-version>2.1.1.GA-JBossAS</jbosscache-core-version>
</properties>
<dependencies>
<dependency>
Modified: core/tags/2.1.1.GA/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/tags/2.1.1.GA/src/main/java/org/jboss/cache/Version.java 2008-04-30 07:25:15 UTC (rev 5766)
+++ core/tags/2.1.1.GA/src/main/java/org/jboss/cache/Version.java 2008-04-30 07:46:37 UTC (rev 5767)
@@ -11,10 +11,10 @@
@Immutable
public class Version
{
- public static final String version = "2.1.1-SNAPSHOT";
+ public static final String version = "2.1.1.GA";
public static final String codename = "Alegrias";
//public static final String cvs = "$Id: Version.java 4592 2007-10-10 16:44:36Z manik.surtani(a)jboss.com $";
- static final byte[] version_id = {'0', '2', '1', '1', 'S'};
+ static final byte[] version_id = {'0', '2', '1', '1'};
private static final int MAJOR_SHIFT = 11;
private static final int MINOR_SHIFT = 6;
16 years, 8 months
JBoss Cache SVN: r5766 - core/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 03:25:15 -0400 (Wed, 30 Apr 2008)
New Revision: 5766
Added:
core/tags/2.1.1.GA/
Log:
Tagging
Copied: core/tags/2.1.1.GA (from rev 5765, core/branches/2.1.X)
16 years, 8 months
JBoss Cache SVN: r5765 - core/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-30 03:24:29 -0400 (Wed, 30 Apr 2008)
New Revision: 5765
Removed:
core/tags/2.1.1.GA/
Log:
16 years, 8 months
JBoss Cache SVN: r5764 - in core/trunk/src: main/release and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-29 19:52:14 -0400 (Tue, 29 Apr 2008)
New Revision: 5764
Modified:
core/trunk/src/main/etc/META-INF/total-replication-cache-service.xml
core/trunk/src/main/release/build.xml
core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java
Log:
Fixed GUI tutorial
Modified: core/trunk/src/main/etc/META-INF/total-replication-cache-service.xml
===================================================================
--- core/trunk/src/main/etc/META-INF/total-replication-cache-service.xml 2008-04-29 23:46:22 UTC (rev 5763)
+++ core/trunk/src/main/etc/META-INF/total-replication-cache-service.xml 2008-04-29 23:52:14 UTC (rev 5764)
@@ -101,15 +101,15 @@
oob_thread_pool.queue_max_size="10"
oob_thread_pool.rejection_policy="Run"/>
- <PING timeout="2000" num_initial_members="3"/>
+ <PING timeout="2000" num_initial_members="2"/>
<MERGE2 max_interval="30000" min_interval="10000"/>
<FD_SOCK/>
<FD timeout="10000" max_tries="5" shun="true"/>
<VERIFY_SUSPECT timeout="1500"/>
<pbcast.NAKACK
- use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
+ use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
@@ -122,7 +122,13 @@
</config>
</attribute>
+ <!--
+ Whether or not to fetch state on joining a cluster
+ NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+ -->
+ <attribute name="FetchInMemoryState">true</attribute>
+
<!--
The max amount of time (in milliseconds) we wait until the
state (ie. the contents of the cache) are retrieved from
Modified: core/trunk/src/main/release/build.xml
===================================================================
--- core/trunk/src/main/release/build.xml 2008-04-29 23:46:22 UTC (rev 5763)
+++ core/trunk/src/main/release/build.xml 2008-04-29 23:52:14 UTC (rev 5764)
@@ -18,9 +18,11 @@
<!-- JVM args for when running tests -->
<property name="jvm.ipv4" value="-Djava.net.preferIPv4Stack=true"/>
<property name="jvm.localhost" value="-Dbind.address=127.0.0.1"/>
- <property name="jvm.ms" value="-Xms128M" />
- <property name="jvm.mx" value="-Xms1024M" />
+ <property name="jvm.ms" value="-Xms128M"/>
+ <property name="jvm.mx" value="-Xms1024M"/>
+ <property name="demo.cfg.file" value="META-INF/total-replication-cache-service.xml"/>
+
<!-- Test if JDK5 is available -->
<available classname="java.lang.Enum" property="HAVE_JDK_1.5"/>
@@ -119,8 +121,8 @@
<classfileset dir="${build}" includes="${test}.class"/>
<jvmarg value="${jvm.ipv4}"/>
<jvmarg value="${jvm.localhost}"/>
- <jvmarg value="${jvm.ms}" />
- <jvmarg value="${jvm.mx}" />
+ <jvmarg value="${jvm.ms}"/>
+ <jvmarg value="${jvm.mx}"/>
</testng>
</target>
@@ -146,6 +148,8 @@
<jvmarg value="${jvm.ipv4}"/>
<jvmarg value="${jvm.localhost}"/>
<arg value="-console"/>
+ <arg value="-config"/>
+ <arg value="${demo.cfg.file}"/>
</java>
</target>
Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java 2008-04-29 23:46:22 UTC (rev 5763)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java 2008-04-29 23:52:14 UTC (rev 5764)
@@ -92,6 +92,7 @@
private List<Address> membership = new LinkedList<Address>();
private Address coordinator = null;
private boolean useConsole = false;
+ JConsole bshConsole;
/**
* Run any work that happens in this interface in a separate thread. This is good practise. Unless there's a
@@ -148,7 +149,7 @@
{
String welcomeMessage = getWelcomeMessage();
- JConsole bshConsole = new JConsole();
+ bshConsole = new JConsole();
Interpreter interpreter = new Interpreter(bshConsole);
configureInterpreter(interpreter, cacheDelegate);
@@ -230,6 +231,8 @@
setCacheModelDelegate(cacheDelegate);
init();
setVisible(true);
+ tree_model.setRoot(myNodeRoot);
+ tree_model.reload();
if (useConsole)
{
@@ -569,7 +572,7 @@
/**
* Recursively adds GUI nodes starting from fqn
*/
- private void addGuiNode(Fqn fqn)
+ private void addGuiNode(Fqn<String> fqn)
{
Set<Object> children;
@@ -584,7 +587,7 @@
{
for (Object child_name : children)
{
- addGuiNode(Fqn.fromRelativeElements(fqn, child_name));
+ addGuiNode(new Fqn<String>(fqn, (String) child_name));
}
}
}
@@ -595,7 +598,7 @@
Fqn<String> fqnToPath;
if (path.length == 0) fqnToPath = Fqn.ROOT;
List<String> elements = convertMyNodeArrayToStringArray(path);
- fqnToPath = Fqn.fromList(elements);
+ fqnToPath = new Fqn<String>(elements);
if (root.hasChild(fqnToPath))
{
return root.getChild(fqnToPath);
@@ -685,7 +688,7 @@
JBossCacheGUI.AddModifyDataForNodeAction addModAction = new JBossCacheGUI.AddModifyDataForNodeAction();
addModAction.putValue(AbstractAction.NAME, "Add/Modify data");
JBossCacheGUI.PrintLockInfoAction print_locks = new JBossCacheGUI.PrintLockInfoAction();
- print_locks.putValue(AbstractAction.NAME, "Print lock information (stdout)");
+ print_locks.putValue(AbstractAction.NAME, "Print lock information" + (useConsole ? "" : " (stdout)"));
JBossCacheGUI.ExitAction exitAction = new JBossCacheGUI.ExitAction();
exitAction.putValue(AbstractAction.NAME, "Exit");
JBossCacheGUI.StartTransaction start_tx = new JBossCacheGUI.StartTransaction();
@@ -1064,7 +1067,27 @@
public void actionPerformed(ActionEvent e)
{
- System.out.println("\n*** lock information ****\n" + CachePrinter.printCacheLockingInfo(cache));
+ if (bshConsole != null)
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ bshConsole.getOut().println("\n*** lock information ****\n" + CachePrinter.printCacheLockingInfo(cache));
+ }
+ }.start();
+
+ }
+ else
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ System.out.println("\n*** lock information ****\n" + CachePrinter.printCacheLockingInfo(cache));
+ }
+ }.start();
+ }
}
}
@@ -1095,6 +1118,7 @@
{
log.trace("node added/modified, updating GUI: " + e);
}
+ if (selected_node == null) return;
clearTable();
Map<String, String> data = selected_node.getData();
Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2008-04-29 23:46:22 UTC (rev 5763)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheView.java 2008-04-29 23:52:14 UTC (rev 5764)
@@ -46,7 +46,7 @@
/**
* Cache configuration file.
*/
- private String configurationFile = "META-INF/replSync-service.xml";
+ private String configurationFile = null;
/**
* The cache model.
@@ -84,10 +84,15 @@
{
parseParameters(args);
+ if (configurationFile == null)
+ {
+ help();
+ throw new Exception("Configuration file cannot be null, please specify with the -config parameter when starting!");
+ }
+
CacheModelDelegate cacheModelDelegate = createCacheDelegate();
- startCacheModelDelegate(cacheModelDelegate);
+ cacheModelDelegate.getGenericCache().start();
setCacheModelDelegate(cacheModelDelegate);
-
start();
}
@@ -102,7 +107,7 @@
{
log.info("start(): creating the GUI");
System.out.println("start(): creating the GUI");
- gui = createCacheGUI(cacheModelDelegate, useConsole);
+ gui = new JBossCacheGUI(cacheModelDelegate, useConsole);
}
}
@@ -171,47 +176,23 @@
{
CacheFactory<String, String> factory = new DefaultCacheFactory();
Cache<String, String> cache = factory.createCache(configurationFile, false);
- // hack to prevent a state transfer for now
- cache.getConfiguration().setFetchInMemoryState(false);
-
CacheModelDelegate delegate = new JBossCacheModelDelegate();
delegate.setCacheShellVariable(cache);
return delegate;
}
- /**
- * Factory method that creates a cache GUI instance
- *
- * @param cacheDelegate cache model instance
- * @param useConsole whether to enable the embedded beanshell console
- * @return instance of cache GUI
- * @throws Exception
- */
- protected JBossCacheGUI createCacheGUI(CacheModelDelegate cacheDelegate, boolean useConsole) throws Exception
- {
- return new JBossCacheGUI(cacheDelegate, useConsole);
- }
-
- /**
- * Starts the cache model
- *
- * @param cacheModelDelegate cache model instance to start
- */
- private void startCacheModelDelegate(CacheModelDelegate cacheModelDelegate)
- {
- cacheModelDelegate.getGenericCache().start();
- }
-
private static void help()
{
System.out.println("JBossCacheView [-help] " +
"[-console] " +
- "[-config <path to configuration file to use>] ");
+ "[-config <path to configuration file to use>]");
System.out.println();
System.out.println("-console enables the embedded BeanShell console");
System.out.println("-config allows you to provide a path to the configuration file to use.");
+ System.out.println();
+ System.out.println();
}
}
16 years, 8 months