Author: mircea.markus
Date: 2008-06-17 11:37:59 -0400 (Tue, 17 Jun 2008)
New Revision: 5996
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheStatus.java
core/trunk/src/main/java/org/jboss/cache/FqnComparator.java
core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
core/trunk/src/main/java/org/jboss/cache/StringFqn.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
Log:
find bugs fixes
Modified: core/trunk/src/main/java/org/jboss/cache/CacheStatus.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheStatus.java 2008-06-17 15:36:31 UTC (rev
5995)
+++ core/trunk/src/main/java/org/jboss/cache/CacheStatus.java 2008-06-17 15:37:59 UTC (rev
5996)
@@ -92,16 +92,10 @@
case STARTING:
case STARTED:
case STOPPED:
- log.debug("Ignoring call to create() as current state is " +
this);
- // fall through
case FAILED:
- return false;
case STOPPING:
case DESTROYING:
- log.warn("Ignoring call to create() while cache is " + this);
return false;
- case INSTANTIATED:
- case DESTROYED:
default:
return true;
}
@@ -127,16 +121,10 @@
case DESTROYED:
case STARTING:
case STARTED:
- log.debug("Ignoring call to start() as current state is " + this);
- // fall through
case FAILED:
- return false;
case STOPPING:
case DESTROYING:
- log.warn("Ignoring call to start() as current state is " + this);
return false;
- case CREATED:
- case STOPPED:
default:
return true;
}
Modified: core/trunk/src/main/java/org/jboss/cache/FqnComparator.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/FqnComparator.java 2008-06-17 15:36:31 UTC
(rev 5995)
+++ core/trunk/src/main/java/org/jboss/cache/FqnComparator.java 2008-06-17 15:37:59 UTC
(rev 5996)
@@ -9,6 +9,7 @@
import net.jcip.annotations.Immutable;
import java.util.Comparator;
+import java.io.Serializable;
/**
* Compares the order of two FQN.
@@ -23,7 +24,7 @@
* @author Steve Woodcock (<a
href="mailto:stevew@jofti.com">stevew@jofti.com</a>)
*/
@Immutable
-public class FqnComparator implements Comparator<Fqn>
+public class FqnComparator implements Comparator<Fqn>, Serializable
{
public static final FqnComparator INSTANCE = new FqnComparator();
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-06-17 15:36:31 UTC (rev
5995)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-06-17 15:37:59 UTC (rev
5996)
@@ -61,7 +61,7 @@
}
@Inject
- private void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration,
+ public void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration,
InvocationContextContainer
invocationContextContainer,
InterceptorChain interceptorChain, CommandsFactory
commandsFactory, LockStrategyFactory lockStrategyFactory)
{
@@ -98,7 +98,7 @@
*/
public NodeSPI<K, V> createDataNode(Object childName, Fqn fqn, NodeSPI<K,
V> parent, Map<K, V> data, boolean mapSafe)
{
- UnversionedNode un = optimistic ? new VersionedNode<K, V>(fqn, parent, data,
cache) : new UnversionedNode<K, V>(childName, fqn, data, mapSafe, cache);
+ UnversionedNode un = optimistic ? new VersionedNode<K, V>(fqn, parent, data,
cache) : new UnversionedNode<K, V>(childName, fqn, data, cache);
// always assume that new nodes do not have data loaded
un.setDataLoaded(false);
NodeInvocationDelegate<K, V> nid = new NodeInvocationDelegate(un);
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-17 15:36:31 UTC
(rev 5995)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-17 15:37:59 UTC
(rev 5996)
@@ -97,7 +97,7 @@
private LockManager lockManager;
@Inject
- private void setupDependencies(ChannelMessageListener messageListener, Configuration
configuration, NotifierImpl notifier,
+ public void setupDependencies(ChannelMessageListener messageListener, Configuration
configuration, NotifierImpl notifier,
CacheSPI spi, Marshaller marshaller, TransactionTable
txTable,
TransactionManager txManager,
InvocationContextContainer container, InterceptorChain interceptorChain,
ComponentRegistry componentRegistry, LockManager
lockManager)
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-06-17 15:36:31 UTC (rev
5995)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-06-17 15:37:59 UTC (rev
5996)
@@ -218,7 +218,7 @@
nodeEventQueue.clear();
}
- private synchronized void createQueue()
+ private void createQueue()
{
if (nodeEventQueue == null)
{
@@ -275,7 +275,7 @@
catch (Exception e)
{
log.fatal("Unable to instantiate eviction policy class " + className,
e);
- return null;
+ throw new IllegalStateException(e);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/StringFqn.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/StringFqn.java 2008-06-17 15:36:31 UTC (rev
5995)
+++ core/trunk/src/main/java/org/jboss/cache/StringFqn.java 2008-06-17 15:37:59 UTC (rev
5996)
@@ -88,6 +88,7 @@
}
@Override
+ @SuppressWarnings(value = "unchecked")
public boolean isChildOrEquals(Fqn parentFqn)
{
if (parentFqn.getClass().equals(StringFqn.class))
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-17 15:36:31 UTC
(rev 5995)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-06-17 15:37:59 UTC
(rev 5996)
@@ -37,7 +37,7 @@
/**
* Debug log.
*/
- protected static Log log = LogFactory.getLog(UnversionedNode.class);
+ static Log log = LogFactory.getLog(UnversionedNode.class);
protected static final boolean trace = log.isTraceEnabled();
/**
@@ -72,19 +72,16 @@
/**
* Constructs a new node with a name, etc.
*
- * @param mapSafe <code>true</code> if param <code>data</code>
can safely be directly assigned to this object's
- * {@link #data} field; <code>false</code> if param
<code>data</code>'s contents should be copied into
- * this object's {@link #data} field.
*/
- protected UnversionedNode(Object child_name, Fqn fqn, Map data, boolean mapSafe,
CacheSPI cache)
+ protected UnversionedNode(Object childName, Fqn fqn, Map data, CacheSPI cache)
{
if (cache == null)
{
throw new IllegalArgumentException("no cache init for " + fqn);
}
- if (!fqn.isRoot() && !child_name.equals(fqn.getLastElement()))
+ if (!fqn.isRoot() && !childName.equals(fqn.getLastElement()))
{
- throw new IllegalArgumentException("Child " + child_name + " must
be last part of " + fqn);
+ throw new IllegalArgumentException("Child " + childName + " must
be last part of " + fqn);
}
initFlags();
Modified: core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-06-17 15:36:31 UTC
(rev 5995)
+++ core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-06-17 15:37:59 UTC
(rev 5996)
@@ -27,7 +27,11 @@
public class VersionedNode<K, V> extends UnversionedNode<K, V>
{
private static final String DATA_VERSION_INTERNAL_KEY =
"_JBOSS_INTERNAL_OPTIMISTIC_DATA_VERSION";
- private DataVersion version; // make sure this is NOT initialized to anything, even a
null! Since the UnversionedNode constructor may set this value based on a data version
passed along in the data map.
+ private DataVersion version; // make sure this is NOT initialized to anything, even a
null! Since the UnversionedNode constructor may set this value based on a data version
passed along in the data map.
+ static
+ {
+ log = LogFactory.getLog(VersionedNode.class);
+ }
/**
* Although this object has a reference to the CacheImpl, the optimistic
@@ -38,12 +42,10 @@
protected VersionedNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data,
CacheSPI<K, V> cache)
{
- super(fqn.getLastElement(), fqn, data, false, cache);
+ super(fqn.getLastElement(), fqn, data, cache);
+ if (parent == null && !fqn.isRoot()) throw new
NullPointerException("parent");
if (version == null) version = DefaultDataVersion.ZERO;
- if (parent == null && !fqn.isRoot()) throw new
NullPointerException("parent");
this.parent = parent;
-
- log = LogFactory.getLog(VersionedNode.class);
}
/**