Author: manik.surtani(a)jboss.com
Date: 2008-06-30 07:58:59 -0400 (Mon, 30 Jun 2008)
New Revision: 6120
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java
core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
Log:
PMD fixes
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -393,10 +393,9 @@
if (trace)
log.trace("callRemoteMethods(): valid members are " + recipients +
" methods: " + command + " Using OOB? " + useOutOfBandMessage);
- if (channel.flushSupported())
+ if (channel.flushSupported() &&
!flushBlockGate.await(configuration.getStateRetrievalTimeout()))
{
- if (!flushBlockGate.await(configuration.getStateRetrievalTimeout()))
- throw new TimeoutException("State retrieval timed out waiting for flush
unblock.");
+ throw new TimeoutException("State retrieval timed out waiting for flush
unblock.");
}
useOutOfBandMessage = false;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/RegionManager.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -12,7 +12,6 @@
import org.jboss.cache.config.EvictionPolicyConfig;
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.EvictionTimerTask;
-import org.jboss.cache.eviction.RegionNameConflictException;
import org.jboss.cache.factories.annotations.Destroy;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/ReplicationException.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -36,10 +36,4 @@
{
super(msg, cause);
}
-
- @Override
- public String toString()
- {
- return super.toString();
- }
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -84,19 +84,16 @@
this.max_elements = configuration.getReplQueueMaxElements();
// check again
enabled = configuration.isUseReplQueue() &&
(configuration.getBuddyReplicationConfig() == null ||
!configuration.getBuddyReplicationConfig().isEnabled());
- if (enabled)
+ if (enabled && interval > 0)
{
- if (interval > 0)
+ if (task == null)
+ task = new ReplicationQueue.MyTask();
+ if (timer == null)
{
- if (task == null)
- task = new ReplicationQueue.MyTask();
- if (timer == null)
- {
- timer = new Timer(true);
- timer.schedule(task,
- 500, // delay before initial flush
- interval); // interval between flushes
- }
+ timer = new Timer(true);
+ timer.schedule(task,
+ 500, // delay before initial flush
+ interval); // interval between flushes
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -12,7 +12,16 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.ClearDataCommand;
+import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import java.util.Collection;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/Visitor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -12,7 +12,16 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.ClearDataCommand;
+import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
/**
* This interface is the core of JBoss Cache, where each {@link VisitableCommand} can be
visited by a Visitor implementation.
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,7 +2,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
import org.jboss.cache.commands.Visitor;
/**
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -5,9 +5,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* Implements functionality defined by {@link
org.jboss.cache.Cache#getKeys(org.jboss.cache.Fqn)}
* <p/>
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,7 +2,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -83,24 +83,22 @@
{
// only attempt to clean up the backup if the primary did not exist - a waste
of a call otherwise.
Object result = executeRemove(gtx, backup);
- if (wasNodeRemoved(result))
+ if (wasNodeRemoved(result) &&
+ buddyFqnTransformer.isDeadBackupFqn(backup) &&
buddyFqnTransformer.isDeadBackupRoot(backup.getParent().getParent()))
{
// if this is a DIRECT child of a DEAD buddy backup region, then remove
the empty dead region structural node.
- if (buddyFqnTransformer.isDeadBackupFqn(backup) &&
buddyFqnTransformer.isDeadBackupRoot(backup.getParent().getParent()))
+ NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(), false);
+ if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
- NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(),
false);
+ if (trace) log.trace("Removing dead backup region " +
deadBackupRoot.getFqn());
+ executeRemove(gtx, deadBackupRoot.getFqn());
+
+ // now check the grand parent and see if we are free of versions
+ deadBackupRoot =
dataContainer.peek(deadBackupRoot.getFqn().getParent(), false);
if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
if (trace) log.trace("Removing dead backup region " +
deadBackupRoot.getFqn());
executeRemove(gtx, deadBackupRoot.getFqn());
-
- // now check the grand parent and see if we are free of versions
- deadBackupRoot =
dataContainer.peek(deadBackupRoot.getFqn().getParent(), false);
- if (deadBackupRoot.getChildrenMapDirect().isEmpty())
- {
- if (trace) log.trace("Removing dead backup region " +
deadBackupRoot.getFqn());
- executeRemove(gtx, deadBackupRoot.getFqn());
- }
}
}
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jgroups.Address;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,21 +2,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.notifications.Notifier;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.Collections;
-import java.util.Map;
-
/**
* Removes a node's content from memory - never removes the node.
- * It also clenups data for resident nodes - which are not being touched by eviction.
+ * It also clenups data for resident nodes - which are not being touched by eviction.
*
* @author Mircea.Markus(a)jboss.com
* @since 2.2
@@ -82,7 +79,7 @@
/**
* //TODO: 2.2.0: rather than using CacheSPI this should use peek(). The other
interceptors should obtain locks and load nodes if necessary for this InvalidateCommand.
- //Even better - this can be handles in the interceptors before call interceptor
+ * //Even better - this can be handles in the interceptors before call interceptor
*/
protected NodeSPI enforceNodeLoading()
{
@@ -91,8 +88,8 @@
/**
- * mark the node to be removed (and all children) as invalid so anyone holding a
direct reference to it will
- be aware that it is no longer valid.
+ * mark the node to be removed (and all children) as invalid so anyone holding a
direct reference to it will
+ * be aware that it is no longer valid.
*/
protected void invalidateNode(NodeSPI node)
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,7 +2,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.commands.read.AbstractDataCommand;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -14,7 +14,6 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.Collections;
-import java.util.Map;
/**
* Behaves like {@link org.jboss.cache.commands.write.InvalidateCommand}. Also,
potentially throws a cache exception if
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -5,7 +5,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.optimistic.DataVersion;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/BaseSortedEvictionAlgorithm.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -28,12 +28,6 @@
private static final boolean trace = log.isTraceEnabled();
@Override
- public void process(Region region) throws EvictionException
- {
- super.process(region);
- }
-
- @Override
protected void processQueues(Region region) throws EvictionException
{
boolean evictionNodesModified = false;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeConfiguration.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -89,7 +89,7 @@
{
if (this == obj)
return true;
- if (obj instanceof ElementSizeConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
return this.maxElementsPerNode == ((ElementSizeConfiguration)
obj).maxElementsPerNode;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/ElementSizeQueue.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -8,7 +8,16 @@
import org.jboss.cache.Fqn;
-import java.util.*;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
/**
* @author Daniel Huang
@@ -57,10 +66,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/EvictionPolicyConfigBase.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -78,10 +78,10 @@
@Override
public boolean equals(Object obj)
{
+ if (obj == null) return false;
if (this == obj)
return true;
-
- if (obj instanceof EvictionPolicyConfigBase)
+ if (getClass().equals(obj.getClass()))
{
EvictionPolicyConfigBase other = (EvictionPolicyConfigBase) obj;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/FIFOConfiguration.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -61,12 +61,6 @@
}
@Override
- public boolean equals(Object obj)
- {
- return (obj instanceof FIFOConfiguration && super.equals(obj));
- }
-
- @Override
protected void setEvictionPolicyClassName()
{
setEvictionPolicyClass(FIFOPolicy.class.getName());
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUConfiguration.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -61,7 +61,7 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof LFUConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
return (this.minNodes == ((LFUConfiguration) obj).minNodes);
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LFUQueue.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -8,7 +8,16 @@
import org.jboss.cache.Fqn;
-import java.util.*;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
/**
* LFUQueue EvictionQueue implementation for LFU Policy.
@@ -61,10 +70,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -89,19 +89,16 @@
@Override
protected void evict(NodeEntry ne)
{
- if (ne != null)
+ if (ne != null && !this.evictCacheNode(ne.getFqn()))
{
- if (!this.evictCacheNode(ne.getFqn()))
+ try
{
- try
- {
- recycleQueue.put(ne.getFqn());
- }
- catch (InterruptedException e)
- {
- log.debug("InterruptedException", e);
- }
+ recycleQueue.put(ne.getFqn());
}
+ catch (InterruptedException e)
+ {
+ log.debug("InterruptedException", e);
+ }
}
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/LRUConfiguration.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -99,7 +99,7 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof LRUConfiguration && super.equals(obj))
+ if (super.equals(obj))
{
LRUConfiguration other = (LRUConfiguration) obj;
return maxAgeSeconds == other.maxAgeSeconds
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUConfiguration.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -66,12 +66,6 @@
}
@Override
- public boolean equals(Object obj)
- {
- return (obj instanceof MRUConfiguration && super.equals(obj));
- }
-
- @Override
public void reset()
{
setMaxNodes(-1);
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/eviction/MRUQueue.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -72,10 +72,8 @@
}
catch (NoSuchElementException e)
{
- //
+ return null;
}
-
- return null;
}
public NodeEntry getNodeEntry(Fqn fqn)
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -189,15 +189,12 @@
String name = type.getName();
Component old = componentLookup.get(name);
- if (old != null)
+ if (old != null && old.instance.equals(component))
{
// if they are equal don't bother
- if (old.instance.equals(component))
- {
- if (trace)
- log.trace("Attempting to register a component equal to one that
already exists under the same name (" + name + "). Not doing anything.");
- return;
- }
+ if (trace)
+ log.trace("Attempting to register a component equal to one that already
exists under the same name (" + name + "). Not doing anything.");
+ return;
}
Component c;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/XmlConfigurationParser.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -253,8 +253,8 @@
catch (NoSuchMethodException me)
{
// this is ok, but certainly log this as a warning
- // this is hugely noisy!
- //if (log.isWarnEnabled()) log.warn("Unrecognised attribute " +
propName + ". Please check your configuration. Ignoring!!");
+ if (log.isDebugEnabled())
+ log.debug("Unrecognised attribute " + propName + ". Please
check your configuration. Ignoring!!");
}
catch (Exception e)
{
@@ -347,6 +347,7 @@
}
catch (Exception e)
{
+ throw new ConfigurationException("Bad buddyCommunicationTimeout [" +
strBuddyCommunicationTimeout + "]");
}
finally
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -95,7 +95,7 @@
public Object visitGetChildrenNamesCommand(InvocationContext ctx,
GetChildrenNamesCommand command) throws Throwable
{
Object returnValue = super.visitGetChildrenNamesCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -103,7 +103,7 @@
public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command)
throws Throwable
{
Object returnValue = super.visitGetKeysCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -111,7 +111,7 @@
public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
throws Throwable
{
Object returnValue = super.visitGetNodeCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -119,7 +119,7 @@
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand
command) throws Throwable
{
Object returnValue = super.visitGetKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -133,7 +133,7 @@
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand
command) throws Throwable
{
Object returnValue = super.visitPutKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -141,7 +141,7 @@
public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
throws Throwable
{
Object returnValue = super.visitPutDataMapCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -149,7 +149,7 @@
public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
throws Throwable
{
Object returnValue = super.visitRemoveKeyCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
+ removeNodeFromCacheLoader(command.getFqn());
return returnValue;
}
@@ -160,8 +160,8 @@
if (trace)
log.trace("This is a move operation; removing the FROM node from the
loader, no activation processing needed.");
loader.remove(command.getFqn());
- removeNodeFromCacheLoader(ctx, command.getFqn().getParent());
- removeNodeFromCacheLoader(ctx, command.getTo());
+ removeNodeFromCacheLoader(command.getFqn().getParent());
+ removeNodeFromCacheLoader(command.getTo());
return returnValue;
}
@@ -172,7 +172,7 @@
* AND it was found in the cache loader (nodeLoaded = true).
* Then notify the listeners that the node has been activated.
*/
- private void removeNodeFromCacheLoader(InvocationContext ctx, Fqn fqn) throws
Throwable
+ private void removeNodeFromCacheLoader(Fqn fqn) throws Throwable
{
NodeSPI n;
if (((n = dataContainer.peek(fqn, true, false)) != null) &&
n.isDataLoaded() && loader.exists(fqn))
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -249,10 +249,9 @@
boolean mustLoad = false;
try
{
- if (needLock)
+ if (needLock && !lockManager.lock(n, LockType.READ, lockOwner))
{
- if (!lockManager.lock(n, LockType.READ, lockOwner))
- throw new TimeoutException("Unable to acquire lock on " + fqn +
". Lock info: " + lockManager.printLockInfo(n));
+ throw new TimeoutException("Unable to acquire lock on " + fqn +
". Lock info: " + lockManager.printLockInfo(n));
}
mustLoad = mustLoad(n, key, allKeys || isMove);
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -8,18 +8,15 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-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.TransactionTable;
import javax.transaction.Transaction;
@@ -36,22 +33,6 @@
*/
public class CallInterceptor extends CommandInterceptor
{
- private TransactionTable transactionTable;
- private boolean cacheLoadingEnabled;
-
- @Inject
- public void injectDependencies(TransactionTable transactionTable)
- {
- this.transactionTable = transactionTable;
- }
-
- @Start
- public void startInterceptor()
- {
- cacheLoadingEnabled = configuration.getCacheLoaderConfig() != null &&
- configuration.getCacheLoaderConfig().getFirstCacheLoaderConfig() != null;
- }
-
@Override
public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
throws Throwable
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -203,12 +203,9 @@
private boolean isGravitationEnabled(InvocationContext ctx)
{
boolean enabled = ctx.isOriginLocal();
- if (enabled)
+ if (enabled && !buddyManager.isAutoDataGravitation())
{
- if (!buddyManager.isAutoDataGravitation())
- {
- enabled = ctx.getOptionOverrides().getForceDataGravitation();
- }
+ enabled = ctx.getOptionOverrides().getForceDataGravitation();
}
return enabled;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -155,10 +155,10 @@
public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
throws Throwable
{
Object retVal = invokeNextInterceptor(ctx, command);
- return handleGetNodeOrDataCommands(ctx, retVal, command.getFqn());
+ return handleGetNodeOrDataCommands(retVal, command.getFqn());
}
- private Object handleGetNodeOrDataCommands(InvocationContext ctx, Object retVal, Fqn
fqn)
+ private Object handleGetNodeOrDataCommands(Object retVal, Fqn fqn)
{
if (retVal == null)
{
@@ -182,7 +182,7 @@
public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command)
throws Throwable
{
Object retVal = invokeNextInterceptor(ctx, command);
- return handleGetNodeOrDataCommands(ctx, retVal, command.getFqn());
+ return handleGetNodeOrDataCommands(retVal, command.getFqn());
}
@Override
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -13,10 +13,10 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Option;
@@ -132,24 +132,21 @@
setTransactionalContext(null, null, null, ctx);
}
- if (optionOverride != null)
+ if (optionOverride != null && optionOverride.isFailSilently())
{
- if (optionOverride.isFailSilently())
+ log.debug("FAIL_SILENTLY Option is present - suspending any ongoing
transaction.");
+ suppressExceptions = true;
+ if (ctx.getTransaction() != null)
{
- log.debug("FAIL_SILENTLY Option is present - suspending any ongoing
transaction.");
- suppressExceptions = true;
- if (ctx.getTransaction() != null)
- {
- suspendedTransaction = txManager.suspend();
- setTransactionalContext(null, null, null, ctx);
- if (trace) log.trace("Suspending transaction " +
suspendedTransaction);
- resumeSuspended = true;
- }
- else
- {
- if (trace) log.trace("No ongoing transaction to suspend");
- }
+ suspendedTransaction = txManager.suspend();
+ setTransactionalContext(null, null, null, ctx);
+ if (trace) log.trace("Suspending transaction " +
suspendedTransaction);
+ resumeSuspended = true;
}
+ else
+ {
+ if (trace) log.trace("No ongoing transaction to suspend");
+ }
}
Object retval;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,14 +1,16 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.marshall.MarshalledValueHelper;
@@ -45,7 +47,7 @@
Set<MarshalledValue> marshalledValues = new
HashSet<MarshalledValue>();
command.setData(wrapMap(command.getData(), marshalledValues, ctx));
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -82,7 +84,7 @@
command.setValue(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -109,7 +111,7 @@
command.setKey(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
@Override
@@ -136,10 +138,10 @@
command.setKey(value);
}
Object retVal = invokeNextInterceptor(ctx, command);
- return compactAndProcessRetVal(command, marshalledValues, retVal);
+ return compactAndProcessRetVal(marshalledValues, retVal);
}
- private Object compactAndProcessRetVal(ReplicableCommand command,
Set<MarshalledValue> marshalledValues, Object retVal)
+ private Object compactAndProcessRetVal(Set<MarshalledValue> marshalledValues,
Object retVal)
throws IOException, ClassNotFoundException
{
if (trace) log.trace("Compacting MarshalledValues created");
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -259,17 +259,14 @@
}
}
- if (!suppressNotification)
+ if (!suppressNotification && nodesCreated.size() > 0)
{
- if (nodesCreated.size() > 0)
+ Notifier n = cache.getNotifier();
+ for (Fqn temp : nodesCreated)
{
- Notifier n = cache.getNotifier();
- for (Fqn temp : nodesCreated)
- {
- n.notifyNodeCreated(temp, true, ctx);
- n.notifyNodeCreated(temp, false, ctx);
- if (trace) log.trace("Notifying cache of node created in workspace
" + temp);
- }
+ n.notifyNodeCreated(temp, true, ctx);
+ n.notifyNodeCreated(temp, false, ctx);
+ if (trace) log.trace("Notifying cache of node created in workspace
" + temp);
}
}
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -30,14 +30,11 @@
*/
public class OptimisticLockingInterceptor extends OptimisticInterceptor
{
- private long lockAcquisitionTimeout;
-
@Start
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/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -27,7 +27,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.notifications.Notifier;
@@ -345,7 +344,6 @@
*/
private void addToModificationList(ReversibleCommand command, InvocationContext ctx)
{
- Option opt = ctx.getOptionOverrides();
ctx.getTransactionEntry().addModification(command);
if (log.isDebugEnabled()) log.debug("Adding command " + command + "
to modification list");
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -14,7 +14,14 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
/**
* This interceptor will call {@link
#skipInterception(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)}
before invoking each visit method
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,6 +1,17 @@
package org.jboss.cache.invocation;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.Version;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -568,12 +579,9 @@
protected void cacheStatusCheck(InvocationContext ctx)
{
assertIsConstructed();
- if (!ctx.getOptionOverrides().isSkipCacheStatusCheck())
+ if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() &&
!componentRegistry.invocationsAllowed(true))
{
- if (!componentRegistry.invocationsAllowed(true))
- {
- throw new IllegalStateException("Cache not in STARTED state!");
- }
+ throw new IllegalStateException("Cache not in STARTED state!");
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-06-29 23:29:19
UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-06-30 11:58:59
UTC (rev 6120)
@@ -99,16 +99,10 @@
String serviceName = cacheObjectName + INTERCEPTOR_KEY +
className.substring(className.lastIndexOf('.') + 1);
ObjectName objName = new ObjectName(serviceName);
- if (!server.isRegistered(objName))
+ if (mbeanExists && !server.isRegistered(objName))
{
- if (mbeanExists)
// register associated interceptor mbean
- {
- server.registerMBean(interceptor, objName);
- }
- //else
- // register dummy interceptor mbean
- // server.registerMBean(new BaseInterceptor(), objName);
+ server.registerMBean(interceptor, objName);
}
}
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -56,7 +56,6 @@
*/
protected Map<Object, List<Modification>> transactions = new
ConcurrentHashMap<Object, List<Modification>>();
-
public void put(Fqn fqn, Map<Object, Object> attributes, boolean erase) throws
Exception
{
if (erase)
@@ -83,8 +82,6 @@
boolean moveToBuddy = subtree.isChildOf(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)
&& subtree.size() > 1;
// store new state
- Fqn fqn;
- //NodeData nd = null;
Object objectFromStream = cache.getMarshaller().objectFromObjectStream(in);
if (objectFromStream instanceof NodeDataMarker)
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,6 +2,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -49,6 +50,7 @@
protected String driverName;
private AdjListJDBCCacheLoaderConfig config;
protected StripedLock lock = new StripedLock();
+ protected static Log log = LogFactory.getLog(AdjListJDBCCacheLoader.class);
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
{
@@ -60,14 +62,14 @@
{
/* Instantiate an standalone connection factory as per configuration, either
explicitly
defined or the default one */
- getLogger().debug("Initialising with a connection factory since data
source is not provided.");
- if (getLogger().isDebugEnabled())
- getLogger().debug("Using connection factory " +
config.getConnectionFactoryClass());
+ log.debug("Initialising with a connection factory since data source is
not provided.");
+ if (log.isDebugEnabled())
+ log.debug("Using connection factory " +
config.getConnectionFactoryClass());
cf = (ConnectionFactory)
Util.loadClass(config.getConnectionFactoryClass()).newInstance();
}
catch (Exception e)
{
- getLogger().error("Connection factory class could not be loaded",
e);
+ log.error("Connection factory class could not be loaded", e);
throw new IllegalStateException("Connection factory class could not be
loaded", e);
}
}
@@ -118,9 +120,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " +
config.getSelectChildNamesSql() + " (" + fqn + ")");
+ log.debug("executing sql: " + config.getSelectChildNamesSql() +
" (" + fqn + ")");
}
con = cf.getConnection();
@@ -226,17 +228,14 @@
{
con = cf.getConnection();
driverName = getDriverName(con);
- if (config.getCreateTable())
+ if (config.getCreateTable() && !tableExists(config.getTable(), con))
{
- if (!tableExists(config.getTable(), con))
+ if (log.isDebugEnabled())
{
- if (getLogger().isDebugEnabled())
- {
- getLogger().debug("executing ddl: " +
config.getCreateTableDDL());
- }
- st = con.createStatement();
- st.executeUpdate(config.getCreateTableDDL());
+ log.debug("executing ddl: " + config.getCreateTableDDL());
}
+ st = con.createStatement();
+ st.executeUpdate(config.getCreateTableDDL());
}
}
finally
@@ -255,9 +254,9 @@
Statement st = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing ddl: " +
config.getDropTableDDL());
+ log.debug("executing ddl: " + config.getDropTableDDL());
}
con = cf.getConnection();
@@ -267,7 +266,7 @@
}
catch (SQLException e)
{
- getLogger().error("Failed to drop table: " + e.getMessage(), e);
+ log.error("Failed to drop table: " + e.getMessage(), e);
}
finally
{
@@ -352,9 +351,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getSelectNodeSql() +
" (" + name + ")");
+ log.debug("executing sql: " + config.getSelectNodeSql() + "
(" + name + ")");
}
con = cf.getConnection();
@@ -412,9 +411,9 @@
PreparedStatement ps = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getInsertNodeSql() +
" (" + name + ")");
+ log.debug("executing sql: " + config.getInsertNodeSql() + "
(" + name + ")");
}
con = cf.getConnection();
@@ -468,7 +467,7 @@
}
catch (Exception e)
{
- getLogger().error("Failed to insert node :" + e.getMessage());
+ log.error("Failed to insert node :" + e.getMessage());
throw new IllegalStateException("Failed to insert node: " +
e.getMessage(), e);
}
finally
@@ -491,9 +490,9 @@
PreparedStatement ps = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getUpdateNodeSql());
+ log.debug("executing sql: " + config.getUpdateNodeSql());
}
con = cf.getConnection();
@@ -624,14 +623,11 @@
}
}
-
- protected abstract Log getLogger();
-
protected abstract AdjListJDBCCacheLoaderConfig
processConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base);
protected void reportAndRethrowError(String message, Exception cause) throws
IllegalStateException
{
- getLogger().error(message, cause);
+ log.error(message, cause);
throw new IllegalStateException(message, cause);
}
@@ -645,7 +641,7 @@
}
catch (IOException e)
{
- getLogger().warn("Failed to close input stream: " +
e.getMessage());
+ log.warn("Failed to close input stream: " + e.getMessage());
}
}
}
@@ -660,7 +656,7 @@
}
catch (SQLException e)
{
- getLogger().warn("Failed to close statement: " + e.getMessage());
+ log.warn("Failed to close statement: " + e.getMessage());
}
}
}
@@ -675,7 +671,7 @@
}
catch (SQLException e)
{
- getLogger().warn("Failed to close result set: " + e.getMessage());
+ log.warn("Failed to close result set: " + e.getMessage());
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -53,7 +53,7 @@
{
File root = null;
String rootPath = null;
- Log log = LogFactory.getLog(getClass());
+ private static final Log log = LogFactory.getLog(FileCacheLoader.class);
protected final StripedLock lock = new StripedLock();
@@ -82,14 +82,14 @@
static
{
- float osVersion = -1;
+ float osVersion;
try
{
osVersion =
Float.parseFloat(System.getProperty("os.version").trim());
}
catch (Exception e)
{
- // ignore
+ osVersion = -1;
}
// 4.x is windows NT/2000 and 5.x is XP.
isOldWindows =
System.getProperty("os.name").toLowerCase().startsWith("windows")
&& osVersion < 4;
@@ -390,16 +390,13 @@
}
}
- if (include_start_dir)
+ if (include_start_dir && !dir.equals(root))
{
- if (!dir.equals(root))
+ if (dir.delete())
{
- if (dir.delete())
- {
- return success;
- }
- success = false;
+ return success;
}
+ success = false;
}
return success;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,7 +1,6 @@
package org.jboss.cache.loader;
import net.jcip.annotations.ThreadSafe;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -37,8 +36,6 @@
@ThreadSafe
public class JDBCCacheLoader extends AdjListJDBCCacheLoader
{
- private static final Log log = LogFactory.getLog(JDBCCacheLoader.class);
-
private JDBCCacheLoaderConfig config;
/**
@@ -123,9 +120,9 @@
ps.setString(1, fqn.isRoot() ? fqn.toString() : fqn + Fqn.SEPARATOR);
lock.acquireLock(fqn, true);
ps.executeUpdate();
- if (getLogger().isTraceEnabled())
+ if (log.isTraceEnabled())
{
- getLogger().trace("Deleting all the children of " + fqn + ".
Used sql is'" + config.getDeleteNodeSql() + '\'');
+ log.trace("Deleting all the children of " + fqn + ". Used sql
is'" + config.getDeleteNodeSql() + '\'');
}
}
catch (SQLException e)
@@ -260,14 +257,6 @@
while (!exists(currentNode));
}
-
- @Override
- protected Log getLogger()
- {
- return log;
- }
-
-
/**
* Start is overwritten for the sake of backward compatibility only.
* Here is the issue: old implementation does not create a Fqn.ROOT if not
specifically told so.
@@ -279,6 +268,7 @@
@Override
public void start() throws Exception
{
+ log = LogFactory.getLog(getClass());
super.start();
if (!exists(Fqn.ROOT) && getNodeCount() > 0)
{
@@ -296,9 +286,9 @@
ResultSet rs = null;
try
{
- if (getLogger().isDebugEnabled())
+ if (log.isDebugEnabled())
{
- getLogger().debug("executing sql: " + config.getNodeCountSql());
+ log.debug("executing sql: " + config.getNodeCountSql());
}
conn = cf.getConnection();
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.loader;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
@@ -68,10 +67,12 @@
@SuppressWarnings("deprecation")
public class JDBCCacheLoaderOld extends AdjListJDBCCacheLoader
{
- private static final Log log = LogFactory.getLog(JDBCCacheLoaderOld.class);
-
private JDBCCacheLoaderOldConfig config;
+ public JDBCCacheLoaderOld()
+ {
+ log = LogFactory.getLog(getClass());
+ }
@Override
public AdjListJDBCCacheLoaderConfig processConfig(IndividualCacheLoaderConfig base)
@@ -323,12 +324,4 @@
insertNode(name, attrs);
}
}
-
-
- @Override
- protected Log getLogger()
- {
- return log;
- }
-
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -3,8 +3,6 @@
import org.jboss.cache.Cache;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import java.util.Properties;
-
public class LocalDelegatingCacheLoaderConfig extends IndividualCacheLoaderConfig
{
private static final long serialVersionUID = 4626734068542420865L;
@@ -28,12 +26,6 @@
}
@Override
- public void setProperties(Properties props)
- {
- super.setProperties(props);
- }
-
- @Override
public boolean equals(Object obj)
{
return obj instanceof LocalDelegatingCacheLoaderConfig &&
equalsExcludingProperties(obj) && delegate == ((LocalDelegatingCacheLoaderConfig)
obj).delegate;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -2,7 +2,6 @@
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;
@@ -130,23 +129,11 @@
}
}
- /**
- * Sets the cache loader's CacheSPI reference and also adds a listener to the
cache that reacts to cluster topology
- * changes.
- *
- * @param c instance of CacheSPI
- */
@Override
- public void setCache(CacheSPI c)
- {
- super.setCache(c);
- }
-
- @Override
public void create() throws Exception
{
super.create();
-
+
cache.addCacheListener(new SingletonStoreListener());
}
@@ -357,13 +344,10 @@
if (newView != null && localAddress != null)
{
Vector mbrs = newView.getMembers();
- if (mbrs != null)
+ if (mbrs != null && mbrs.size() > 0 &&
localAddress.equals(mbrs.firstElement()))
{
- if (mbrs.size() > 0 && localAddress.equals(mbrs.firstElement()))
- {
- /* This node is the coordinator */
- return true;
- }
+ /* This node is the coordinator */
+ return true;
}
return false;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -137,7 +137,8 @@
throw new CacheException("Problems invoking method call!", e);
}
}
- } while (System.currentTimeMillis() < endTime);
+ }
+ while (System.currentTimeMillis() < endTime);
throw new CacheException("Unable to communicate with TCPCacheServer(" +
config.getHost() + ":" + config.getPort() + ") after " +
config.getTimeout() + " millis, with reconnects every " +
config.getReconnectWaitTime() + " millis.");
}
@@ -384,6 +385,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream.",
e);
}
try
{
@@ -391,6 +393,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream.",
e);
}
try
{
@@ -398,6 +401,7 @@
}
catch (IOException e)
{
+ if (log.isDebugEnabled()) log.debug("Unable to close socket.", e);
}
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -490,13 +490,11 @@
{
TupleBrowser browser = tree.browse(name);
Tuple t = new Tuple();
- if (browser.getNext(t))
+ if (browser.getNext(t) && self)
{
- if (self)
- {
- tree.remove(t.getKey());
- }
+ tree.remove(t.getKey());
}
+
while (browser.getNext(t))
{
Fqn fqn = (Fqn) t.getKey();
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -198,7 +198,7 @@
}
catch (IOException e)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close server
socket", e);
}
}
}
@@ -265,7 +265,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream",
th);
}
try
{
@@ -273,7 +273,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close TCP stream",
th);
}
try
{
@@ -281,7 +281,7 @@
}
catch (Throwable th)
{
- // nada
+ if (log.isDebugEnabled()) log.debug("Unable to close socket", th);
}
// remove self from connections list
@@ -296,7 +296,7 @@
NodeSPI n;
boolean flag;
- while (t != null && Thread.currentThread().equals(t))
+ while (t != null && t.equals(Thread.currentThread()))
{
try
{
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/lock/StripedLock.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -3,6 +3,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import java.util.List;
@@ -104,7 +105,7 @@
}
catch (IllegalMonitorStateException imse)
{
- // perhaps the RL was already released earlier?
+ throw new CacheException("Lock is held by a different thread! Cannot be
unlocked by current thread.", imse);
}
}
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -45,10 +45,4 @@
{
super(msg, cause);
}
-
- @Override
- public String toString()
- {
- return super.toString();
- }
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -17,7 +17,6 @@
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.LinkedList;
import java.util.List;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -369,13 +369,10 @@
Object name = internalFqn.get(parent.getFqn().size());
cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
Node result = parent.getChild(name);
- if (result != null)
+ if (result != null && internalFqn.size() < result.getFqn().size())
{
- if (internalFqn.size() < result.getFqn().size())
- {
- // need to recursively walk down the tree
- result = getInternalNode(result, internalFqn);
- }
+ // need to recursively walk down the tree
+ result = getInternalNode(result, internalFqn);
}
return result;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/statetransfer/StateTransferFactory.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -6,6 +6,8 @@
*/
package org.jboss.cache.statetransfer;
+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.Version;
@@ -23,6 +25,7 @@
public abstract class StateTransferFactory
{
private static final short RV_200 = Version.getVersionShort("2.0.0");
+ private static final Log log = LogFactory.getLog(StateTransferFactory.class);
/**
* Gets the StateTransferGenerator able to handle the given cache instance.
@@ -58,8 +61,9 @@
{
in.close();
}
- catch (IOException ignored)
+ catch (IOException e)
{
+ if (log.isWarnEnabled()) log.warn("Unable to close stream!", e);
}
throw new IllegalStateException("Stream corrupted ", io);
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyContext.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,21 +1,12 @@
package org.jboss.cache.transaction;
import javax.naming.Binding;
-import javax.naming.CompoundName;
import javax.naming.Context;
-import javax.naming.ContextNotEmptyException;
import javax.naming.Name;
-import javax.naming.NameAlreadyBoundException;
import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InvalidAttributesException;
import java.util.HashMap;
import java.util.Hashtable;
@@ -73,7 +64,7 @@
* @see #bind(String,Object)
* @see #rebind(Name,Object)
* @see DirContext#bind(Name,Object,
- *Attributes)
+ * Attributes)
*/
public void bind(Name name, Object obj) throws NamingException
{
@@ -111,7 +102,7 @@
* @see #rebind(String,Object)
* @see #bind(Name,Object)
* @see DirContext#rebind(Name,Object,
- *Attributes)
+ * Attributes)
* @see DirContext
*/
public void rebind(Name name, Object obj) throws NamingException
@@ -480,7 +471,7 @@
* @throws NamingException if a naming exception is encountered
*/
public String composeName(String name, String prefix)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -499,7 +490,7 @@
* @see #removeFromEnvironment(String)
*/
public Object addToEnvironment(String propName, Object propVal)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -517,7 +508,7 @@
* @see #addToEnvironment(String,Object)
*/
public Object removeFromEnvironment(String propName)
- throws NamingException
+ throws NamingException
{
return null;
}
@@ -536,7 +527,7 @@
* @see #addToEnvironment(String,Object)
* @see #removeFromEnvironment(String)
*/
- public Hashtable<?,?> getEnvironment() throws NamingException
+ public Hashtable<?, ?> getEnvironment() throws NamingException
{
return null;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/DummyTransaction.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -51,8 +51,8 @@
* transaction.
*/
public void commit()
- throws RollbackException, HeuristicMixedException,
HeuristicRollbackException,
- SecurityException, SystemException
+ throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
+ SecurityException, SystemException
{
boolean doCommit;
status = Status.STATUS_PREPARING;
@@ -104,6 +104,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
status = Status.STATUS_ROLLEDBACK;
@@ -167,7 +168,7 @@
* unexpected way.
*/
public boolean enlistResource(XAResource xaRes)
- throws RollbackException, IllegalStateException, SystemException
+ throws RollbackException, IllegalStateException, SystemException
{
throw new SystemException("not supported");
}
@@ -184,7 +185,7 @@
* unexpected way.
*/
public boolean delistResource(XAResource xaRes, int flag)
- throws IllegalStateException, SystemException
+ throws IllegalStateException, SystemException
{
throw new SystemException("not supported");
}
@@ -203,7 +204,7 @@
* unexpected way.
*/
public void registerSynchronization(Synchronization sync)
- throws RollbackException, IllegalStateException, SystemException
+ throws RollbackException, IllegalStateException, SystemException
{
if (sync == null)
throw new IllegalArgumentException("null synchronization " + this);
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -269,6 +269,7 @@
}
catch (SystemException e)
{
+ // do nothing
}
// JBCACHE-982 -- don't complain if COMMITTED
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java 2008-06-29
23:29:19 UTC (rev 6119)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/xml/XmlHelper.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -404,14 +404,11 @@
public static boolean readBooleanAttribute(Element elem, String elementName, String
attributeName, boolean defaultValue)
{
String val = getAttributeValue(elem, elementName, attributeName);
- if (val != null)
+ if (val != null && (val.equalsIgnoreCase("true") ||
val.equalsIgnoreCase("false")))
{
- if (val.equalsIgnoreCase("true") ||
val.equalsIgnoreCase("false"))
- {
- //return Boolean.parseBoolean(val);
- // needs to be done this way because of JBBUILD-351
- return Boolean.valueOf(val);
- }
+ //return Boolean.parseBoolean(val);
+ // needs to be done this way because of JBBUILD-351
+ return Boolean.valueOf(val);
}
return defaultValue;
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/RollbackOnNoOpTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,16 +1,14 @@
package org.jboss.cache.commands;
-import org.testng.annotations.Test;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import java.util.HashMap;
/**
* @author Mircea.Markus(a)jboss.com
@@ -64,7 +62,7 @@
public void testRemoveKeyCommand() throws Exception
{
txMgr.begin();
- cache.remove("/blah/blah","key");
+ cache.remove("/blah/blah", "key");
txMgr.rollback();
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/StructuralNodesOnRollbackTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,13 +1,12 @@
package org.jboss.cache.commands;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
import java.util.HashMap;
@@ -43,23 +42,23 @@
public void testPutDataMap() throws Exception
{
HashMap map = new HashMap();
- map.put("k","v");
+ map.put("k", "v");
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
txMgr.begin();
cache.put("/a/b/c", map);
- assert cache.exists("/a/b");
+ assert cache.exists("/a/b");
txMgr.rollback();
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
}
-
+
public void testPutKeyValueCommand() throws Exception
{
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
txMgr.begin();
cache.put("/a/b/c", "key", "value");
- assert cache.exists("/a/b");
+ assert cache.exists("/a/b");
txMgr.rollback();
- assert !cache.exists("/a/b");
+ assert !cache.exists("/a/b");
}
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetChildrenNamesCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,10 +1,10 @@
package org.jboss.cache.commands.read;
-import static org.easymock.EasyMock.*;
-
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.mock.NodeSpiMock;
import org.testng.annotations.Test;
-import org.jboss.cache.mock.NodeSpiMock;
-import org.jboss.cache.mock.MockNodesFixture;
import java.util.Set;
@@ -14,7 +14,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test (groups="unit")
+@Test(groups = "unit")
public class GetChildrenNamesCommandTest extends AbstractDataCommandTest
{
private GetChildrenNamesCommand command;
@@ -35,7 +35,7 @@
Set result = (Set) command.perform(null);
assert result.isEmpty() : "empty result expected";
}
-
+
public void testPerformInexistingNode()
{
expect(container.peek(testFqn)).andReturn(null);
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetDataMapCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,8 +1,9 @@
package org.jboss.cache.commands.read;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import org.jboss.cache.mock.NodeSpiMock;
import org.testng.annotations.Test;
-import static org.easymock.EasyMock.*;
-import org.jboss.cache.mock.NodeSpiMock;
import java.util.Map;
@@ -33,8 +34,8 @@
public void testForExistingNode()
{
NodeSpiMock node = new NodeSpiMock(testFqn);
- node.putDirect("k1","v1");
- node.putDirect("k2","v2");
+ node.putDirect("k1", "v1");
+ node.putDirect("k2", "v2");
expect(container.peek(testFqn)).andReturn(node);
replay(container);
Map result = (Map) command.perform(null);
@@ -46,7 +47,8 @@
{
result.put("k3", "v3");
assert false : "map should be immutable";
- } catch (RuntimeException ex)
+ }
+ catch (RuntimeException ex)
{
//expected
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeyValueCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,13 +1,14 @@
package org.jboss.cache.commands.read;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import static org.easymock.EasyMock.*;
-import org.easymock.*;
-import org.jboss.cache.notifications.Notifier;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.mock.NodeSpiMock;
+import org.jboss.cache.notifications.Notifier;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
/**
* Tester class for {@link GetKeyValueCommand}.
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GetKeysCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.read;
-import org.testng.annotations.Test;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import org.jboss.cache.mock.NodeSpiMock;
+import org.testng.annotations.Test;
import java.util.Set;
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,11 +1,16 @@
package org.jboss.cache.commands.read;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.mock.NodeSpiMock;
import org.jgroups.stack.IpAddress;
@@ -21,7 +26,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test(groups="unit")
+@Test(groups = "unit")
public class GravitateDataCommandTest
{
GravitateDataCommand command;
@@ -81,7 +86,7 @@
control.replay();
GravitateResult result = (GravitateResult) command.perform(ctx);
- assert result.getNodeData()== listReference;
+ assert result.getNodeData() == listReference;
control.verify();
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.testng.annotations.Test;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import java.util.Collections;
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test (groups = "unit")
+@Test(groups = "unit")
public class ClearDataCommandTest extends AbstractVersionedDataCommandTest
{
@@ -63,9 +63,10 @@
try
{
command.rollback();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
- assert false : "should not fail but expect this scenarion";
+ assert false : "should not fail but expect this scenarion";
}
}
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/CreateNodeCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,10 +1,9 @@
package org.jboss.cache.commands.write;
import static org.easymock.EasyMock.*;
-
-import org.testng.annotations.Test;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
import org.jboss.cache.mock.MockNodesFixture;
+import org.testng.annotations.Test;
import java.util.ArrayList;
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,15 +1,15 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
-import org.easymock.IMocksControl;
-import static org.easymock.EasyMock.createStrictControl;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.notifications.Notifier;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
@@ -67,7 +67,7 @@
public void testRootNodeInvalidation()
{
command.setFqn(Fqn.ROOT);
- nodes.adfgNode.put("key","value");
+ nodes.adfgNode.put("key", "value");
expect(spiMock.getNode(Fqn.ROOT)).andReturn(nodes.root);
notifier.notifyNodeEvicted(Fqn.ROOT, true, ctx);
expect(container.evict(Fqn.ROOT)).andReturn(Boolean.TRUE);
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,14 +1,14 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
-import org.jboss.cache.commands.read.AbstractDataCommandTest;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeNotExistsException;
-import org.easymock.IMocksControl;
-import static org.easymock.EasyMock.createStrictControl;
+import org.jboss.cache.commands.read.AbstractDataCommandTest;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.notifications.Notifier;
import org.testng.annotations.Test;
/**
@@ -48,7 +48,8 @@
{
command.perform(ctx);
assert false : "should have thrown an exception as the source is
null";
- } catch (NodeNotExistsException e)
+ }
+ catch (NodeNotExistsException e)
{
//expected
}
@@ -64,7 +65,8 @@
{
command.perform(ctx);
assert false : "should have thrown an exception as the source is
null";
- } catch (NodeNotExistsException e)
+ }
+ catch (NodeNotExistsException e)
{
//expected
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/OptimisticInvalidateCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,18 +1,19 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.optimistic.DefaultDataVersion;
import org.testng.annotations.Test;
+import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import javax.transaction.Transaction;
import java.util.Collections;
/**
@@ -82,7 +83,8 @@
{
command.perform(ctx);
assert false : "exception expected";
- } catch (Exception e)
+ }
+ catch (Exception e)
{
//expected as there is a version mismatch
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutDataMapCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,18 +1,19 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
-import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.mock.NodeSpiMock;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.mock.NodeSpiMock;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* Tester class for {@link PutDataMapCommand}
@@ -45,7 +46,7 @@
container = control.createMock(DataContainer.class);
command.initialize(notifier, container);
node = new NodeSpiMock(testFqn);
- node.put("k","v");
+ node.put("k", "v");
}
public void testAddDataNoErase()
@@ -58,15 +59,15 @@
notifier.notifyNodeModified(testFqn, true,
NodeModifiedEvent.ModificationType.PUT_MAP, node.getData(), null);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(testFqn, false,
NodeModifiedEvent.ModificationType.PUT_MAP, expected, null);
-
+
control.replay();
assert null == command.perform(null) : "null result is always expected";
assert command.getOldData().size() == 1;
assert command.getOldData().get("k").equals("v");
control.verify();
}
-
+
public void testRollbackNonexistentNode()
{
expect(container.peek(testFqn, false, true)).andReturn(null);
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/PutKeyValueCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,12 +1,12 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
+import static org.easymock.EasyMock.expect;
import org.jboss.cache.CacheException;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.testng.annotations.Test;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* tester class for {@link PutKeyValueCommand}.
@@ -33,7 +33,8 @@
{
command.perform(ctx);
assert false : "exception should have been thrown as data does not
exists.";
- } catch (Exception e)
+ }
+ catch (Exception e)
{
//expected
}
@@ -88,6 +89,6 @@
command.rollback();
assert nodes.adfNode.getData().size() == 1;
assert "oldValue".equals(nodes.adfNode.getData().get("k"));
- control.verify();
+ control.verify();
}
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveKeyCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,12 +1,11 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.testng.annotations.Test;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* tester class for {@link RemoveKeyCommand}.
@@ -14,7 +13,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test(groups="unit")
+@Test(groups = "unit")
public class RemoveKeyCommandTest extends AbstractVersionedDataCommandTest
{
RemoveKeyCommand command;
@@ -38,13 +37,13 @@
public void testRemoveNonexistentPair()
{
Map expected = new HashMap();
- expected.put("newKey","newValue");
+ expected.put("newKey", "newValue");
nodes.adfgNode.putAll(expected);
expect(container.peek(fqn, false, false)).andReturn(nodes.adfgNode);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(fqn, true,
NodeModifiedEvent.ModificationType.REMOVE_DATA, expected, ctx);
expected = new HashMap();
- expected.put(key,null);
+ expected.put(key, null);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
notifier.notifyNodeModified(fqn, false,
NodeModifiedEvent.ModificationType.REMOVE_DATA, expected, ctx);
control.replay();
@@ -65,7 +64,7 @@
public void testRemoveExistentPair()
{
Map expected = new HashMap();
- expected.put(key,"newValue");
+ expected.put(key, "newValue");
nodes.adfgNode.putAll(expected);
expect(container.peek(fqn, false, false)).andReturn(nodes.adfgNode);
expect(notifier.shouldNotifyOnNodeModified()).andReturn(true);
@@ -97,7 +96,8 @@
try
{
command.rollback();
- } catch (Exception ex)
+ }
+ catch (Exception ex)
{
assert false : "No exception should be thrown here.";
}
Modified:
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
===================================================================
---
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-29
23:29:19 UTC (rev 6119)
+++
core/branches/2.2.X/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-30
11:58:59 UTC (rev 6120)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.transaction.GlobalTransaction;
import org.testng.annotations.Test;
-import org.jboss.cache.transaction.GlobalTransaction;
/**
* tester for {@link RemoveNodeCommand}.
@@ -33,7 +33,7 @@
{
//aditional setup
command.setSkipSendingNodeEvents(true); //no notification
- nodes.adfNode.put("akey","avalue");
+ nodes.adfNode.put("akey", "avalue");
ctx.setGlobalTransaction(new GlobalTransaction());
//check perform
@@ -53,11 +53,12 @@
command.rollback();
assert nodes.adNode.hasChild("f");
}
+
public void testRemovalNoNotificationsInvalidNode()
{
command.setSkipSendingNodeEvents(true); //no notification
nodes.adfNode.setValid(false, false); //invalid node
-
+
expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(nodes.adfNode);
control.replay();
assert Boolean.FALSE == command.perform(ctx);
@@ -65,7 +66,7 @@
assert nodes.adfhNode.isDeleted();
control.verify();
}
-
+
public void testRemovalWithNotificationsInvalidNode()
{
nodes.adfNode.setValid(false, false); //invalid node