Author: manik.surtani(a)jboss.com
Date: 2008-07-30 08:30:50 -0400 (Wed, 30 Jul 2008)
New Revision: 6439
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainer.java
core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
Log:
Fixed stuff
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-07-30 12:05:49 UTC
(rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-07-30 12:30:50 UTC
(rev 6439)
@@ -202,4 +202,9 @@
* @return true if the node exists and is marked as resident, false otherwise.
*/
boolean isResident(Fqn fqn);
+
+ /**
+ * @return a string representation of the contents of the data container
+ */
+ String printDetails();
}
Modified: core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-07-30
12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java 2008-07-30
12:30:50 UTC (rev 6439)
@@ -33,8 +33,13 @@
protected void inactivateRegion(Fqn fqn) throws CacheException
{
if (isActivatingDeactivating(fqn))
- throw new CacheException("Region " + fqn + " is already being
activated/deactivated");
+ {
+// throw new CacheException("Region " + fqn + " is already being
activated/deactivated");
+ log.warn("Region " + fqn + " is already being
activated/deactivated");
+ return;
+ }
+
NodeSPI parent = null;
NodeSPI subtreeRoot = null;
boolean parentLocked = false;
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-30
12:05:49 UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-30
12:30:50 UTC (rev 6439)
@@ -331,7 +331,27 @@
}
}
+ /**
+ * Adds details of the node into a map as strings.
+ */
@Override
+ protected void printDetailsInMap(StringBuilder sb, int indent)
+ {
+ printIndent(sb, indent);
+ indent += 2;// increse it
+ sb.append(Fqn.SEPARATOR);
+ if (!fqn.isRoot()) sb.append(fqn.getLastElement());
+ sb.append(" ");
+ sb.append(data);
+ for (Node n : children().values())
+ {
+ sb.append("\n");
+ ((NodeSPI) n).printDetails(sb, indent);
+ }
+ }
+
+
+ @Override
public void setFqn(Fqn fqn)
{
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-07-30 12:05:49 UTC
(rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-07-30 12:30:50 UTC
(rev 6439)
@@ -617,6 +617,7 @@
// and roll back any tx and break any locks
List<Address> removed = new ArrayList<Address>(members);
removed.removeAll(newMembers);
+
spi.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
NodeSPI root = spi.getRoot();
if (root != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-30 12:05:49 UTC
(rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-30 12:30:50 UTC
(rev 6439)
@@ -506,7 +506,7 @@
}
}
- private void printIndent(StringBuilder sb, int indent)
+ protected final void printIndent(StringBuilder sb, int indent)
{
if (sb != null)
{
@@ -550,18 +550,19 @@
/**
* Adds details of the node into a map as strings.
*/
- private void printDetailsInMap(StringBuilder sb, int indent)
+ protected void printDetailsInMap(StringBuilder sb, int indent)
{
printIndent(sb, indent);
indent += 2;// increse it
- if (!(getFqn()).isRoot())
+ sb.append(Fqn.SEPARATOR);
+ if (!fqn.isRoot()) sb.append(fqn.getLastElement());
+ sb.append(" ");
+ sb.append(data);
+ for (InternalNode n : children().values())
{
- sb.append(Fqn.SEPARATOR);
+ sb.append("\n");
+ n.printDetails(sb, indent);
}
- sb.append(fqn.getLastElement());
- sb.append(" ");
- sb.append(data);
- sb.append(children);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-07-30 12:05:49
UTC (rev 6438)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-07-30 12:30:50
UTC (rev 6439)
@@ -2,6 +2,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.DataContainerImpl;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
@@ -23,7 +24,7 @@
public static String printCacheDetails(Cache c)
{
// internal cast
- DataContainerImpl ci = (DataContainerImpl) ((CacheInvocationDelegate)
c).getDataContainer();
+ DataContainer ci = ((CacheInvocationDelegate) c).getDataContainer();
return ci.printDetails();
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-07-30
12:05:49 UTC (rev 6438)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-07-30
12:30:50 UTC (rev 6439)
@@ -6,12 +6,13 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.util.TestingUtil;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.CacheStarted;
import org.jboss.cache.notifications.annotation.CacheStopped;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import static org.testng.AssertJUnit.*;
@@ -366,6 +367,10 @@
String details = html ? wrapper.printCacheDetailsAsHtml() :
wrapper.printCacheDetails();
+
+ System.out.println("Cache details: " +
CachePrinter.printCacheDetails(cache));
+ System.out.println("Details: " + details);
+
assertTrue("Details include testing",
details.contains("testing"));
assertTrue("Details include jmx", details.contains("jmx"));
assertTrue("Details include foobar",
details.contains("foobar"));
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30
12:05:49 UTC (rev 6438)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2008-07-30
12:30:50 UTC (rev 6439)
@@ -39,10 +39,9 @@
@Test(groups = "functional")
public class StateTransferConcurrencyTest extends StateTransferTestBase
{
-
protected String getReplicationVersion()
{
- return "2.2.0.GA";
+ return "3.0.0.GA";
}
/**
@@ -64,6 +63,7 @@
*
* @throws Exception
*/
+ @Test(invocationCount = 5)
public void testConcurrentActivationAsync() throws Exception
{
concurrentActivationTest(false);
@@ -484,7 +484,7 @@
caches.put("evict2", cache2);
Region region = cache2.getRegion(Fqn.ROOT, false);
- // We expect events for /a, /a/b and /a/b/c
+ // We expect a VISIT event for / and ADD events for /a, /a/b and /a/b/c
int nodeEventQueueSize = region.nodeEventQueueSize();
int i = 0;
while (region.nodeEventQueueSize() > 0)
@@ -492,7 +492,7 @@
System.out.println(++i + ") Queue contains : " +
region.takeLastEventNode());
}
- assertEquals("Saw the expected number of node events", 3,
nodeEventQueueSize);
+ assertEquals("Saw the expected number of node events", 4,
nodeEventQueueSize);
}
/**