JBoss Cache SVN: r4693 - core/trunk/src/test/java/org/jboss/cache/statetransfer.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-10-26 09:06:27 -0400 (Fri, 26 Oct 2007)
New Revision: 4693
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
Log:
on testConcurrency - don't wait on all the regions to be active
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2007-10-26 12:59:26 UTC (rev 4692)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java 2007-10-26 13:06:27 UTC (rev 4693)
@@ -662,7 +662,7 @@
System.out.println("---- Cache" + name + " = " + cache.getLocalAddress() + " being used");
TestingUtil.sleepRandom(5000);
createAndActivateRegion(cache, A_B);
- waitUntillAllChachesActivatedRegion();
+// waitUntillAllChachesActivatedRegion();
System.out.println(name + " activated region" + " " + System.currentTimeMillis());
Fqn<String> childFqn = new Fqn<String>(A_B, name);
17 years, 2 months
JBoss Cache SVN: r4692 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-10-26 08:59:26 -0400 (Fri, 26 Oct 2007)
New Revision: 4692
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionManager.java
Log:
marked a node as being ative only after state transfer took place
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2007-10-26 12:15:22 UTC (rev 4691)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2007-10-26 12:59:26 UTC (rev 4692)
@@ -295,24 +295,23 @@
else
{
//r.activate();
- r.setActive(true);
- // FIXME - persistent state transfer counts too!
if (cache.getConfiguration().isFetchInMemoryState())
{
activateRegion(r.getFqn(), suppressRegionNotEmptyException);
}
+ r.setActive(true);
}
}
else if (defaultInactive)
{
// "Active" region is not the default, so create a region
r = getRegion(fqn, true);
- r.setActive(true);
// FIXME - persistent state transfer counts too!
if (cache.getConfiguration().isFetchInMemoryState())
{
activateRegion(r.getFqn(), suppressRegionNotEmptyException);
}
+ r.setActive(true);
}
}
catch (RuntimeException re)
17 years, 2 months
JBoss Cache SVN: r4691 - in core/trunk/src: main/java/org/jboss/cache/config and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-10-26 08:15:22 -0400 (Fri, 26 Oct 2007)
New Revision: 4691
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
Log:
Updated cfg to use jgroups flush-udp.xml file by default, and added helpers to UnitTestCacheConfigurationFactory to inject delays.
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-10-26 10:46:14 UTC (rev 4690)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-10-26 12:15:22 UTC (rev 4691)
@@ -4273,28 +4273,32 @@
if (log.isDebugEnabled())
{
log.debug("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() +
- " using stack " + configuration.getMultiplexerStack());
+ " using stack " + configuration.getMultiplexerStack());
}
}
else
{
- if (configuration.getClusterConfig() == null)
- {
- log.debug("setting cluster properties to default value");
- configuration.setClusterConfig(configuration.getDefaultClusterConfig());
- }
+
try
{
- channel = new JChannel(configuration.getClusterConfig());
+ if (configuration.getClusterConfig() == null)
+ {
+ log.debug("setting cluster properties to default value");
+ channel = new JChannel(configuration.getDefaultClusterConfig());
+ }
+ else
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Cache cluster properties: " + configuration.getClusterConfig());
+ }
+ channel = new JChannel(configuration.getClusterConfig());
+ }
}
- catch (Exception e)
+ catch (ChannelException el)
{
- throw new CacheException("Unable to create JGroups channel", e);
+ el.printStackTrace();
}
- if (log.isTraceEnabled())
- {
- log.trace("cache properties: " + configuration.getClusterConfig());
- }
}
configuration.getRuntimeConfig().setChannel(channel);
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2007-10-26 10:46:14 UTC (rev 4690)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2007-10-26 12:15:22 UTC (rev 4691)
@@ -12,6 +12,7 @@
import org.jboss.cache.lock.IsolationLevel;
import org.w3c.dom.Element;
+import java.net.URL;
import java.util.Locale;
/**
@@ -629,23 +630,14 @@
}
/**
- * Returns the default JGroup properties.
+ * Returns a {@link java.net.URL} to a default JGroups configuration file.
+ * @return a default JGroups config file
*/
- public String getDefaultClusterConfig()
+ public URL getDefaultClusterConfig()
{
- return "UDP(mcast_addr=224.0.0.36;mcast_port=55566;ip_ttl=32;" +
- "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
- "PING(timeout=1000;num_initial_members=2):" +
- "MERGE2(min_interval=5000;max_interval=10000):" +
- "FD_SOCK:" +
- "VERIFY_SUSPECT(timeout=1500):" +
- "pbcast.NAKACK(gc_lag=50;retransmit_timeout=600,1200,2400,4800):" +
- "UNICAST(timeout=600,1200,2400,4800):" +
- "pbcast.STABLE(desired_avg_gossip=20000):" +
- "FRAG(frag_size=8192):" +
- "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
- "shun=false;print_local_addr=true):" +
- "pbcast.STATE_TRANSFER";
+ URL url = getClass().getClassLoader().getResource("flush-udp.xml");
+ if (log.isTraceEnabled()) log.trace("Using default JGroups configuration file " + url);
+ return url;
}
Modified: core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2007-10-26 10:46:14 UTC (rev 4690)
+++ core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java 2007-10-26 12:15:22 UTC (rev 4691)
@@ -12,10 +12,12 @@
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.transaction.TransactionSetup;
import org.jboss.cache.xml.XmlHelper;
+import org.jgroups.conf.XmlConfigurator;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.io.InputStream;
+import java.net.URL;
/**
* Cache configuration factory used by unit tests.
@@ -89,6 +91,47 @@
return XmlConfigurationParser.parseCacheLoaderConfig(element);
}
+ /**
+ * Helper method that takes a <b>JGroups</b> configuration file and creates an old-style JGroups config {@link String} that can be used
+ * in {@link org.jboss.cache.config.Configuration#setClusterConfig(String)}. Note that expressions
+ * in the file - such as <tt>${jgroups.udp.mcast_port:45588}</tt> are expanded out accordingly.
+ * @param url url to the cfg file
+ * @return a String
+ */
+ public static String getClusterConfigFromFile(URL url)
+ {
+ try
+ {
+ XmlConfigurator conf = XmlConfigurator.getInstance(url);
+ String tmp = conf.getProtocolStackString();
+ // parse this string for ${} substitutions
+ // Highly crappy approach!!
+ tmp = tmp.replace("${jgroups.udp.mcast_addr:228.10.10.10}", "228.10.10.10");
+ tmp = tmp.replace("${jgroups.udp.mcast_port:45588}", "45588");
+ tmp = tmp.replace("${jgroups.udp.ip_ttl:2}", "2");
+ System.out.println("config string: " + tmp);
+ return tmp;
+
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Problems with url " + url, e);
+ }
+ }
+
+ /**
+ * Takes a JGroups configuration "old-style" String and injects the "DELAY" protcol.
+ * @param jgroupsConfigString JGroups config string
+ * @param incomingDelay incoming delay
+ * @param outgoingDelay outgoing delay
+ * @return new string
+ */
+ public static String injectDelay(String jgroupsConfigString, int incomingDelay, int outgoingDelay)
+ {
+ String delay = ":DELAY(in_delay=" +incomingDelay+ ";out_delay="+outgoingDelay+")";
+ return jgroupsConfigString.substring(0, jgroupsConfigString.indexOf(":")) + delay + jgroupsConfigString.substring(jgroupsConfigString.indexOf(":"));
+ }
+
private static class UnitTestXmlConfigurationParser extends XmlConfigurationParser
{
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2007-10-26 10:46:14 UTC (rev 4690)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2007-10-26 12:15:22 UTC (rev 4691)
@@ -1,11 +1,11 @@
package org.jboss.cache.replicated;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.ReplicationException;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
@@ -58,11 +58,9 @@
{
cache1.getConfiguration().setSyncReplTimeout(1); // 1ms. this is *bound* to fail.
cache2.getConfiguration().setSyncReplTimeout(1);
+ String s = UnitTestCacheConfigurationFactory.getClusterConfigFromFile(cache1.getConfiguration().getDefaultClusterConfig());
+ String newCfg = UnitTestCacheConfigurationFactory.injectDelay(s, 100, 100);
- String jgroupsCfg = cache1.getConfiguration().getDefaultClusterConfig();
- String delay = ":DELAY(in_delay=100;out_delay=100)";
- String newCfg = jgroupsCfg.substring(0, jgroupsCfg.indexOf(":")) + delay + jgroupsCfg.substring(jgroupsCfg.indexOf(":"));
-
cache1.getConfiguration().setClusterConfig(newCfg);
cache2.getConfiguration().setClusterConfig(newCfg);
17 years, 2 months
JBoss Cache SVN: r4690 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-10-26 06:46:14 -0400 (Fri, 26 Oct 2007)
New Revision: 4690
Modified:
core/trunk/src/main/java/org/jboss/cache/Version.java
Log:
Updated to CR1
Modified: core/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Version.java 2007-10-26 10:41:55 UTC (rev 4689)
+++ core/trunk/src/main/java/org/jboss/cache/Version.java 2007-10-26 10:46:14 UTC (rev 4690)
@@ -11,10 +11,10 @@
@Immutable
public class Version
{
- public static final String version = "2.1.0-SNAPSHOT";
+ public static final String version = "2.1.0.CR1";
public static final String codename = "Alegrias";
public static final String cvs = "$Id: Version.java 4592 2007-10-10 16:44:36Z manik.surtani(a)jboss.com $";
- static final byte[] version_id = {'0', '2', '1', '0', 'B'};
+ static final byte[] version_id = {'0', '2', '1', '0', 'C'};
private static final int MAJOR_SHIFT = 11;
private static final int MINOR_SHIFT = 6;
17 years, 2 months
JBoss Cache SVN: r4689 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-10-26 06:41:55 -0400 (Fri, 26 Oct 2007)
New Revision: 4689
Modified:
core/trunk/pom.xml
Log:
Updated to CR1
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2007-10-25 06:22:27 UTC (rev 4688)
+++ core/trunk/pom.xml 2007-10-26 10:41:55 UTC (rev 4689)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>2.1.0-SNAPSHOT</jbosscache-core-version>
+ <jbosscache-core-version>2.1.0.CR1</jbosscache-core-version>
</properties>
<parent>
<groupId>org.jboss.cache</groupId>
17 years, 2 months
JBoss Cache SVN: r4688 - core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-10-25 02:22:27 -0400 (Thu, 25 Oct 2007)
New Revision: 4688
Modified:
core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
Log:
clean import
Modified: core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2007-10-25 06:20:32 UTC (rev 4687)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2007-10-25 06:22:27 UTC (rev 4688)
@@ -10,7 +10,6 @@
import java.util.List;
import java.util.Set;
-import org.jboss.cache.AbstractTreeCacheListener;
import org.jboss.cache.TreeCache;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
17 years, 2 months
JBoss Cache SVN: r4687 - core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-10-25 02:20:32 -0400 (Thu, 25 Oct 2007)
New Revision: 4687
Modified:
core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
Log:
[JBCACHE-1194] Test data gravitation when nodes with the data are slow to respond
Modified: core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2007-10-25 06:00:40 UTC (rev 4686)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2007-10-25 06:20:32 UTC (rev 4687)
@@ -7,13 +7,18 @@
package org.jboss.cache.buddyreplication;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.jboss.cache.AbstractTreeCacheListener;
import org.jboss.cache.TreeCache;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
+import org.jboss.cache.interceptors.Interceptor;
+import org.jboss.cache.marshall.JBCMethodCall;
+import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.misc.TestingUtil;
+import org.jgroups.blocks.MethodCall;
/**
* Tests behaviour when data owners fail - essentially this tests data gravitation
@@ -248,40 +253,77 @@
assertNull("Backup should not exist on node3", caches[3].get(backupFqn, key));
// Add a listener that will delay data gravitation from node0
- BlockingListener listener0 = new BlockingListener();
- caches[1].addTreeCacheListener(listener0);
+ BlockingInterceptor interceptor0 = insertBlockingInterceptor(caches[0]);
// Add a listener that will delay data gravitation from node1
- BlockingListener listener1 = new BlockingListener();
- caches[1].addTreeCacheListener(listener1);
+ BlockingInterceptor interceptor1 = insertBlockingInterceptor(caches[1]);
Option opt = new Option();
opt.setForceDataGravitation(true);
- assertEquals("Gravitation to node4 successful", value, caches[3].get(fqn, key, opt));
+ assertEquals("Gravitation to node4 successful", value, caches[3].get(fqn, key, opt));
// Just double-check the listeners worked as expected
- assertNull("Listener0 saw no exception", listener0.exception);
- assertNull("Listener1 saw no exception", listener1.exception);
- assertTrue("Known issue JBCACHE-1192: listener0 blocked " + fqn, listener0.visited.contains(fqn));
- assertTrue("Known issue JBCACHE-1192: listener1 blocked " + backupFqn, listener1.visited.contains(backupFqn));
+ synchronized (interceptor0.monitor)
+ {
+ interceptor0.monitor.notifyAll();
+ }
+ synchronized (interceptor1.monitor)
+ {
+ interceptor1.monitor.notifyAll();
+ }
+
+ TestingUtil.sleepThread(5);
+
+ assertNull("interceptor0 saw no exception", interceptor0.exception);
+ assertNull("interceptor1 saw no exception", interceptor1.exception);
+ assertTrue("interceptor0 blocked " + fqn, interceptor0.blocked.contains(fqn));
+ assertTrue("interceptor1 blocked " + backupFqn, interceptor1.blocked.contains(backupFqn));
+
+
}
- private class BlockingListener extends AbstractTreeCacheListener
+ private BlockingInterceptor insertBlockingInterceptor(TreeCache cache)
{
+ BlockingInterceptor interceptor = new BlockingInterceptor();
+
+ List interceptors = cache.getInterceptors();
+ Interceptor first = (Interceptor) interceptors.get(0);
+ Interceptor next = first.getNext();
+
+ interceptor.setNext(next);
+ first.setNext(interceptor);
+
+ return interceptor;
+ }
+
+ private class BlockingInterceptor extends Interceptor
+ {
Exception exception = null;
- Set visited = new HashSet();
+ Set blocked = new HashSet();
+ Object monitor = new Object();
- public void nodeVisited(Fqn fqn)
- {
- try
+ public Object invoke(MethodCall m) throws Throwable
+ {
+ JBCMethodCall call = (JBCMethodCall) m;
+ if (call.getMethodId() == MethodDeclarations.getNodeMethodLocal_id)
{
- Thread.sleep(2000);
- visited.add(fqn);
+ try
+ {
+ Object[] args = call.getArgs();
+ Fqn fqn = (Fqn) args[0];
+ synchronized (monitor)
+ {
+ monitor.wait(2000);
+ }
+ blocked.add(fqn);
+ }
+ catch (Exception e)
+ {
+ exception = e;
+ }
+
}
- catch (Exception e)
- {
- exception = e;
- }
+ return super.invoke(m);
}
}
17 years, 2 months