[infinispan-commits] Infinispan SVN: r1206 - in trunk: core/src/test/java/org/infinispan/api and 3 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Nov 23 14:06:32 EST 2009


Author: mircea.markus
Date: 2009-11-23 14:06:31 -0500 (Mon, 23 Nov 2009)
New Revision: 1206

Added:
   trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java
   trunk/core/src/test/resources/configs/no-flush.xml
Modified:
   trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java
   trunk/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java
   trunk/core/src/test/resources/configs/named-cache-test.xml
   trunk/core/src/test/resources/configs/string-property-replaced.xml
   trunk/server/rest/README.txt
Log:
[ISPN-282] - (enforce flush)

Modified: trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java	2009-11-23 14:15:50 UTC (rev 1205)
+++ trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java	2009-11-23 19:06:31 UTC (rev 1206)
@@ -24,6 +24,7 @@
 
 import org.infinispan.CacheException;
 import org.infinispan.commands.ReplicableCommand;
+import org.infinispan.config.ConfigurationException;
 import org.infinispan.config.GlobalConfiguration;
 import org.infinispan.config.parsing.XmlConfigHelper;
 import org.infinispan.marshall.Marshaller;
@@ -53,6 +54,7 @@
 import org.jgroups.View;
 import org.jgroups.blocks.GroupRequest;
 import org.jgroups.blocks.RspFilter;
+import org.jgroups.protocols.pbcast.FLUSH;
 import org.jgroups.protocols.pbcast.STREAMING_STATE_TRANSFER;
 import org.jgroups.stack.ProtocolStack;
 import org.jgroups.util.Rsp;
@@ -161,9 +163,8 @@
 
       // ensure that the channel has FLUSH enabled.
       // see ISPN-83 for details.
-      if (!channel.flushSupported()) {
-         log.warn("FLUSH is not present in your JGroups stack!  FLUSH is needed to ensure messages are not dropped while new nodes join the cluster.  Will proceed, but inconsistencies may arise!");
-      }
+      if ( channel.getProtocolStack()!= null && channel.getProtocolStack().findProtocol(FLUSH.class) == null)
+         throw new ConfigurationException("Flush should be enabled. This is related to https://jira.jboss.org/jira/browse/ISPN-83");
    }
 
    public int getViewId() {

Added: trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java	                        (rev 0)
+++ trunk/core/src/test/java/org/infinispan/api/NoFlushFailureTest.java	2009-11-23 19:06:31 UTC (rev 1206)
@@ -0,0 +1,34 @@
+package org.infinispan.api;
+
+import org.infinispan.Cache;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.DefaultCacheManager;
+import org.testng.annotations.Test;
+
+/**
+ * This is related to  https://jira.jboss.org/jira/browse/ISPN-83
+ *
+ * @author Mircea.Markus at jboss.com
+ */
+ at Test(groups = "functional", testName = "api.NoFlushFailureTest")
+public class NoFlushFailureTest {
+
+   CacheManager cm1;
+   CacheManager cm2;
+   private static final String FILE = "configs/no-flush.xml";
+   private Cache<Object,Object> c1;
+   private Cache<Object,Object> c2;
+
+   @Test
+   public void simpleTest() throws Exception {
+      cm1 = new DefaultCacheManager(FILE);
+      try {
+         cm1.getCache();
+         assert false : "Exception expected!";
+      } catch (Exception e) {
+         //expected
+      }
+   }
+}
+
+

Modified: trunk/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java	2009-11-23 14:15:50 UTC (rev 1205)
+++ trunk/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java	2009-11-23 19:06:31 UTC (rev 1206)
@@ -32,7 +32,7 @@
       asyncListenerExecutorProperties.get("maxThreads").equals("2");
 
       Properties transportProps = cacheManager.getGlobalConfiguration().getTransportProperties();
-      assert transportProps.get("configurationFile").equals("udp.xml");
+      assert transportProps.get("configurationFile").equals("config-samples/jgroups-tcp.xml");
    }
 
    public void testDefaultCache() {

Modified: trunk/core/src/test/resources/configs/named-cache-test.xml
===================================================================
--- trunk/core/src/test/resources/configs/named-cache-test.xml	2009-11-23 14:15:50 UTC (rev 1205)
+++ trunk/core/src/test/resources/configs/named-cache-test.xml	2009-11-23 19:06:31 UTC (rev 1206)
@@ -32,7 +32,7 @@
       <transport clusterName="infinispan-cluster" distributedSyncTimeout="50000" nodeName="Jalapeno">
          <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
          <properties>
-         <property name="configurationFile" value="udp.xml"/>
+         <property name="configurationFile" value="config-samples/jgroups-udp.xml"/>
          </properties>
          <!-- See the JGroupsTransport javadocs for more flags -->
       </transport>

Added: trunk/core/src/test/resources/configs/no-flush.xml
===================================================================
--- trunk/core/src/test/resources/configs/no-flush.xml	                        (rev 0)
+++ trunk/core/src/test/resources/configs/no-flush.xml	2009-11-23 19:06:31 UTC (rev 1206)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
+
+   <!-- *************************** -->
+   <!-- System-wide global settings -->
+   <!-- *************************** -->
+
+   <global>
+
+      <asyncListenerExecutor factory="org.infinispan.executors.DefaultExecutorFactory">
+         <properties>
+            <property name="maxThreads" value="5"/>
+            <property name="threadNamePrefix" value="AsyncListenerThread"/>
+         </properties>
+      </asyncListenerExecutor>
+      <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
+         <properties>
+            <property name="configurationFile" value="udp.xml"/>
+         </properties>
+      </transport>
+
+
+   </global>
+
+   <!-- *************************** -->
+   <!-- Default "template" settings -->
+   <!-- *************************** -->
+   <default>
+      <clustering mode="D">
+         <async/>
+         <hash numOwners="1" rehashEnabled="false"/>
+         <l1 enabled="true"/>
+      </clustering>
+   </default>
+</infinispan>

Modified: trunk/core/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- trunk/core/src/test/resources/configs/string-property-replaced.xml	2009-11-23 14:15:50 UTC (rev 1205)
+++ trunk/core/src/test/resources/configs/string-property-replaced.xml	2009-11-23 19:06:31 UTC (rev 1206)
@@ -17,7 +17,7 @@
 
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
       <properties>
-         <property name="configurationFile" value="${test.property.jgroupsConfigFile:udp.xml}"/>
+         <property name="configurationFile" value="${test.property.jgroupsConfigFile:config-samples/jgroups-tcp.xml}"/>
          </properties>
       </transport>
 

Modified: trunk/server/rest/README.txt
===================================================================
--- trunk/server/rest/README.txt	2009-11-23 14:15:50 UTC (rev 1205)
+++ trunk/server/rest/README.txt	2009-11-23 19:06:31 UTC (rev 1206)
@@ -1,2 +1,6 @@
 This is the RESTful server for the Infinispan Data Grid. 
 Build this as a war, and access server/infinispan-rest to see details on how to use it.
+
+NOTE: you might want to pass these params to the servlet container: -Dbind.address=<bind_address> -Djava.net.preferIPv4Stack=true
+These might be needed for a correct setup of jgroups. E.g. for Tomcat, these can be set like this:
+      export JAVA_OPTS="-Dbind.address=127.0.0.1 -Djava.net.preferIPv4Stack=true" before starting container  



More information about the infinispan-commits mailing list