JBoss Cache SVN: r8169 - in core/trunk/src/main/java/org/jboss/cache: config/parsing and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-07 08:01:23 -0400 (Fri, 07 Aug 2009)
New Revision: 8169
Modified:
core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/RPCManager.java
core/trunk/src/main/java/org/jboss/cache/StringFqn.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/util/Immutables.java
Log:
PMD code warnings
Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -21,8 +21,6 @@
*/
package org.jboss.cache;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import static org.jboss.cache.AbstractNode.NodeFlags.REMOVED;
import static org.jboss.cache.AbstractNode.NodeFlags.RESIDENT;
import org.jboss.cache.lock.IdentityLock;
@@ -43,7 +41,6 @@
protected ConcurrentMap children; // purposefully NOT genericized yet, since UnversionedNode and PessimisticUnversionedNode will both store different types.
protected Fqn fqn;
- private static final Log log = LogFactory.getLog(AbstractNode.class);
/**
* Flags placed on the node. Replaces older 'boolean' flags.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -24,7 +24,6 @@
import org.jboss.cache.annotations.Compat;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.LegacyConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
import org.jboss.cache.factories.ComponentFactory;
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -21,16 +21,15 @@
*/
package org.jboss.cache;
-import java.util.List;
-import java.util.Vector;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
import org.jboss.cache.RPCManagerImpl.FlushTracker;
import org.jboss.cache.commands.ReplicableCommand;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.blocks.RspFilter;
+import java.util.List;
+import java.util.Vector;
+
/**
* Provides a mechanism for communicating with other caches in the cluster. For now this is based on JGroups as an underlying
* transport, and in future more transport options may become available.
Modified: core/trunk/src/main/java/org/jboss/cache/StringFqn.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/StringFqn.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/StringFqn.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -103,6 +103,12 @@
}
@Override
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ @Override
protected int calculateHashCode()
{
return stringRepresentation.hashCode();
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser2x.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -127,8 +127,7 @@
private void correctEvictionUnlimitedValues(EvictionConfig ec)
{
EvictionRegionConfig def = ec.getDefaultEvictionRegionConfig();
- EvictionAlgorithmConfig eac = def.getEvictionAlgorithmConfig();
-
+ def.getEvictionAlgorithmConfig();
}
/**
@@ -547,10 +546,11 @@
try
{
intval = Integer.parseInt(value);
-
}
catch (NumberFormatException e)
{
+ // do nothing
+ log.debug("Unable to parse number", e);
}
value = intval < 1 ? "-1" : value;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -242,10 +242,8 @@
private boolean childrenLoaded(InternalNode<?, ?> node) throws Exception
{
- if (!node.isChildrenLoaded())
- {
- if (loader.getChildrenNames(node.getFqn()) != null) return false;
- }
+ if (!node.isChildrenLoaded() && loader.getChildrenNames(node.getFqn()) != null) return false;
+
for (InternalNode child : node.getChildren())
{
if (!child.isDataLoaded())
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -355,7 +355,7 @@
GravitateDataCommand command = commandsFactory.buildGravitateDataCommand(fqn, searchSubtrees);
// doing a GET_ALL is crappy but necessary since JGroups' GET_FIRST could return null results from nodes that do
// not have either the primary OR backup, and stop polling other valid nodes.
- List resps = rpcManager.callRemoteMethods(null, command, GroupRequest.GET_ALL, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(rpcManager.getMembers().size(), rpcManager.getLocalAddress()), false);
+ List resps = rpcManager.callRemoteMethods(null, command, GroupRequest.GET_ALL, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(rpcManager.getMembers().size()), false);
if (trace) log.trace("got responses " + resps);
@@ -466,10 +466,9 @@
public static class ResponseValidityFilter implements RspFilter
{
- private boolean validResponseFound;
int memberCount;
- public ResponseValidityFilter(int memberCount, Address localAddress)
+ public ResponseValidityFilter(int memberCount)
{
this.memberCount = memberCount;
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -276,17 +276,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/trunk/src/main/java/org/jboss/cache/util/Immutables.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/Immutables.java 2009-08-07 11:50:17 UTC (rev 8168)
+++ core/trunk/src/main/java/org/jboss/cache/util/Immutables.java 2009-08-07 12:01:23 UTC (rev 8169)
@@ -233,6 +233,8 @@
}
catch (Exception e)
{
+ // do nothing.
+ e.printStackTrace(System.out);
}
}
@@ -248,6 +250,8 @@
}
catch (Exception e)
{
+ // do nothing.
+ e.printStackTrace(System.out);
}
return null;