[infinispan-commits] Infinispan SVN: r2035 - in branches/4.1.x: core/src/test/java/org/infinispan/distribution/rehash and 9 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Jul 15 04:35:35 EDT 2010


Author: galder.zamarreno at jboss.com
Date: 2010-07-15 04:35:33 -0400 (Thu, 15 Jul 2010)
New Revision: 2035

Added:
   branches/4.1.x/server/core/src/test/scala/org/infinispan/server/core/AbstractProtocolServerTest.scala
   branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodServerTest.scala
   branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedServerTest.scala
Modified:
   branches/4.1.x/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java
   branches/4.1.x/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java
   branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala
   branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala
   branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/ProtocolServer.scala
   branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala
   branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodProxyTest.scala
   branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/test/HotRodTestingUtil.scala
   branches/4.1.x/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala
   branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/test/MemcachedTestingUtil.scala
   branches/4.1.x/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java
Log:
[ISPN-540] (Programmatically started servers should assume default host and port) Done.

Modified: branches/4.1.x/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java
===================================================================
--- branches/4.1.x/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/core/src/test/java/org/infinispan/config/ProgrammaticConfigurationTest.java	2010-07-15 08:35:33 UTC (rev 2035)
@@ -9,7 +9,7 @@
  * // TODO: Document this
  *
  * @author Galder Zamarreño
- * @since // TODO
+ * @since 4.1
  */
 @Test(groups = "functional", testName = "config.ProgrammaticConfigurationTest")
 public class ProgrammaticConfigurationTest extends AbstractInfinispanTest {

Modified: branches/4.1.x/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java
===================================================================
--- branches/4.1.x/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/core/src/test/java/org/infinispan/distribution/rehash/RehashCompletedOnJoinTest.java	2010-07-15 08:35:33 UTC (rev 2035)
@@ -14,9 +14,9 @@
  * // TODO: Document this
  *
  * @author Galder Zamarreño
- * @since // TODO
+ * @since 4.1
  */
- at Test(groups = "functional", testName = "distribution.rehash.WorkDuringJoinTest")
+ at Test(groups = "functional", testName = "distribution.rehash.RehashCompletedOnJoinTest")
 public class RehashCompletedOnJoinTest extends BaseDistFunctionalTest {
 
    public RehashCompletedOnJoinTest() {

Modified: branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala
===================================================================
--- branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -21,16 +21,41 @@
    private var transport: Transport = _
    private var cacheManager: EmbeddedCacheManager = _
 
-   override def start(properties: Properties, cacheManager: EmbeddedCacheManager) {
-      this.host = properties.getProperty(PROP_KEY_HOST)
-      this.port = properties.getProperty(PROP_KEY_PORT).toInt
+   def start(properties: Properties, cacheManager: EmbeddedCacheManager, defaultPort: Int) {
+      this.host = properties.getProperty(PROP_KEY_HOST, HOST_DEFAULT)
+      this.port = properties.getProperty(PROP_KEY_PORT, defaultPort.toString).toInt
       this.masterThreads = properties.getProperty(PROP_KEY_MASTER_THREADS, MASTER_THREADS_DEFAULT).toInt
+      if (masterThreads < 0)
+         throw new IllegalArgumentException("Master threads can't be lower than 0: " + masterThreads)
+
       this.workerThreads = properties.getProperty(PROP_KEY_WORKER_THREADS, WORKER_THREADS_DEFAULT).toInt
+      if (workerThreads < 0)
+         throw new IllegalArgumentException("Worker threads can't be lower than 0: " + masterThreads)
+      
       this.cacheManager = cacheManager
       val idleTimeout = properties.getProperty(PROP_KEY_IDLE_TIMEOUT, IDLE_TIMEOUT_DEFAULT).toInt
-      val tcpNoDelay = properties.getProperty(PROP_KEY_TCP_NO_DELAY, TCP_NO_DELAY_DEFAULT).toBoolean
+      if (idleTimeout < -1)
+         throw new IllegalArgumentException("Idle timeout can't be lower than -1: " + idleTimeout)
+
+      val tcpNoDelayString = properties.getProperty(PROP_KEY_TCP_NO_DELAY, TCP_NO_DELAY_DEFAULT)
+      val tcpNoDelay =
+         try {
+            tcpNoDelayString.toBoolean
+         } catch {
+            case n: NumberFormatException => {
+               throw new IllegalArgumentException("TCP no delay flag switch must be a boolean: " + tcpNoDelayString)
+            }
+         }
+
       val sendBufSize = properties.getProperty(PROP_KEY_SEND_BUF_SIZE, SEND_BUF_SIZE_DEFAULT).toInt
+      if (sendBufSize < 0) {
+         throw new IllegalArgumentException("Send buffer size can't be lower than 0: " + sendBufSize)
+      }
+      
       val recvBufSize = properties.getProperty(PROP_KEY_RECV_BUF_SIZE, RECV_BUF_SIZE_DEFAULT).toInt
+      if (recvBufSize < 0) {
+         throw new IllegalArgumentException("Send buffer size can't be lower than 0: " + sendBufSize)
+      }
 
       // Register rank calculator before starting any cache so that we can capture all view changes
       cacheManager.addListener(getRankCalculatorListener)

Modified: branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala
===================================================================
--- branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -46,18 +46,7 @@
     * information to get the server up and running. Use System
     * properties for defaults.
     */
-   private val props: Properties = {
-      // Set default properties
-      val properties = new Properties(System.getProperties)
-      properties.setProperty(PROP_KEY_HOST, HOST_DEFAULT)
-      properties.setProperty(PROP_KEY_MASTER_THREADS, MASTER_THREADS_DEFAULT)
-      properties.setProperty(PROP_KEY_WORKER_THREADS, WORKER_THREADS_DEFAULT)
-      properties.setProperty(PROP_KEY_IDLE_TIMEOUT, IDLE_TIMEOUT_DEFAULT)
-      properties.setProperty(PROP_KEY_TCP_NO_DELAY, TCP_NO_DELAY_DEFAULT)
-      properties.setProperty(PROP_KEY_SEND_BUF_SIZE, SEND_BUF_SIZE_DEFAULT)
-      properties.setProperty(PROP_KEY_RECV_BUF_SIZE, RECV_BUF_SIZE_DEFAULT)
-      properties
-   }
+   private val props: Properties = new Properties(System.getProperties)
    
    private var programName: String = _
    private var server: ProtocolServer = _
@@ -92,45 +81,12 @@
       // First process the command line to pickup custom props/settings
       processCommandLine(args)
 
-      val properties = new Properties
-
-      val masterThreads = props.getProperty(PROP_KEY_MASTER_THREADS).toInt
-      if (masterThreads < 0)
-         throw new IllegalArgumentException("Master threads can't be lower than 0: " + masterThreads)
-      
-      val workerThreads = props.getProperty(PROP_KEY_WORKER_THREADS).toInt
-      if (workerThreads < 0)
-         throw new IllegalArgumentException("Worker threads can't be lower than 0: " + masterThreads)
-
       var protocol = props.getProperty(PROP_KEY_PROTOCOL)
       if (protocol == null) {
          System.err.println("ERROR: Please indicate protocol to run with -r parameter")
          showAndExit
       }
       
-      val idleTimeout = props.getProperty(PROP_KEY_IDLE_TIMEOUT).toInt
-      if (idleTimeout < -1)
-         throw new IllegalArgumentException("Idle timeout can't be lower than -1: " + idleTimeout)
-
-      val tcpNoDelay = props.getProperty(PROP_KEY_TCP_NO_DELAY)
-      try {
-         tcpNoDelay.toBoolean
-      } catch {
-         case n: NumberFormatException => {
-            throw new IllegalArgumentException("TCP no delay flag switch must be a boolean: " + tcpNoDelay)
-         }
-      }
-
-      val sendBufSize = props.getProperty(PROP_KEY_SEND_BUF_SIZE).toInt
-      if (sendBufSize < 0) {
-         throw new IllegalArgumentException("Send buffer size can't be lower than 0: " + sendBufSize)
-      }
-
-      val recvBufSize = props.getProperty(PROP_KEY_SEND_BUF_SIZE).toInt
-      if (recvBufSize < 0) {
-         throw new IllegalArgumentException("Send buffer size can't be lower than 0: " + sendBufSize)
-      }
-
       // TODO: move class name and protocol number to a resource file under the corresponding project
       val clazz = protocol match {
          case "memcached" => "org.infinispan.server.memcached.MemcachedServer"
@@ -139,26 +95,6 @@
       }
       val server = Util.getInstance(clazz).asInstanceOf[ProtocolServer]
 
-      val port = {
-         if (props.getProperty(PROP_KEY_PORT) == null) {
-            protocol match {
-               case "memcached" => 11211
-               case "hotrod" => 11311
-               case "websocket" => 8181
-            }
-         } else {
-            props.getProperty(PROP_KEY_PORT).toInt
-         }
-      }
-      props.setProperty(PROP_KEY_PORT, port.toString)
-
-      // If no proxy host given, external host defaults to configured host
-      val externalHost = props.getProperty(PROP_KEY_PROXY_HOST, props.getProperty(PROP_KEY_HOST))
-      props.setProperty(PROP_KEY_PROXY_HOST, externalHost)
-      // If no proxy port given, external port defaults to configured port
-      val externalPort = props.getProperty(PROP_KEY_PROXY_PORT, props.getProperty(PROP_KEY_PORT))
-      props.setProperty(PROP_KEY_PROXY_PORT, externalPort)
-
       val configFile = props.getProperty(PROP_KEY_CACHE_CONFIG)
       val cacheManager = if (configFile == null) new DefaultCacheManager else new DefaultCacheManager(configFile)
       // Servers need a shutdown hook to close down network layer, so there's no need for an extra shutdown hook.

Modified: branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/ProtocolServer.scala
===================================================================
--- branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/ProtocolServer.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/ProtocolServer.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -5,20 +5,35 @@
 import java.util.Properties
 
 /**
- * // TODO: Document this
+ * Represents a protocol compliant server.
+ *
  * @author Galder Zamarreño
  * @since 4.1
  */
 trait ProtocolServer {
 
    /**
-    * Using Properties here instead of a Map in order to make it easier for java code to call in.
+    * Starts the server backed by the given cache manager and with the corresponding properties. If properties object
+    * is either null or empty, default values depending on the server type are assumed. Note that properties mandate
+    * String keys and values. Accepted property keys and default values are listed in {@link Main} class.
     */
    def start(properties: Properties, cacheManager: EmbeddedCacheManager)
 
+   /**
+    * Stops the server
+    */
    def stop
 
+   /**
+    * Gets the encoder for this protocol server. The encoder is responsible for writing back common header responses
+    * back to client. This method can return null if the server has no encoder. You can find an example of the server
+    * that has no encoder in the Memcached server.
+    */
    def getEncoder: Encoder
 
+   /**
+    * Gets the decoder for this protocol server. The decoder is responsible for reading client requests.
+    * This method cannot return null.
+    */
    def getDecoder: Decoder
 }

Added: branches/4.1.x/server/core/src/test/scala/org/infinispan/server/core/AbstractProtocolServerTest.scala
===================================================================
--- branches/4.1.x/server/core/src/test/scala/org/infinispan/server/core/AbstractProtocolServerTest.scala	                        (rev 0)
+++ branches/4.1.x/server/core/src/test/scala/org/infinispan/server/core/AbstractProtocolServerTest.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -0,0 +1,76 @@
+package org.infinispan.server.core
+
+import org.testng.annotations.Test
+import java.util.Properties
+import transport.{Decoder, Encoder}
+import org.infinispan.server.core.Main._
+import org.infinispan.manager.{DefaultCacheManager, EmbeddedCacheManager}
+
+/**
+ * Abstract protocol server test.
+ *
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+ at Test(groups = Array("functional"), testName = "server.core.AbstractProtocolServerTest")
+class AbstractProtocolServerTest {
+
+   def testValidateNegativeMasterThreads {
+      val p = new Properties
+      p.setProperty(PROP_KEY_MASTER_THREADS, "-1")
+      expectIllegalArgument(p, createServer)
+   }
+
+   def testValidateNegativeWorkerThreads {
+      val p = new Properties
+      p.setProperty(PROP_KEY_WORKER_THREADS, "-1")
+      expectIllegalArgument(p, createServer)
+   }
+
+   def testValidateNegativeIdleTimeout {
+      val p = new Properties
+      p.setProperty(PROP_KEY_IDLE_TIMEOUT, "-1")
+      expectIllegalArgument(p, createServer)
+   }
+
+   def testValidateIllegalTcpNoDelay {
+      val p = new Properties
+      p.setProperty(PROP_KEY_TCP_NO_DELAY, "blah")
+      expectIllegalArgument(p, createServer)
+   }
+
+   def testValidateNegativeSendBufSize {
+      val p = new Properties
+      p.setProperty(PROP_KEY_SEND_BUF_SIZE, "-1")
+      expectIllegalArgument(p, createServer)
+   }
+
+   def testValidateNegativeRecvBufSize {
+      val p = new Properties
+      p.setProperty(PROP_KEY_RECV_BUF_SIZE, "-1")
+      expectIllegalArgument(p, createServer)
+   }
+
+   private def expectIllegalArgument(p: Properties, server: ProtocolServer) {
+      try {
+         server.start(p, new DefaultCacheManager)
+      } catch {
+         case i: IllegalArgumentException => // expected
+      } finally {
+         server.stop
+      }
+   }
+
+   private def createServer : ProtocolServer = {
+      new AbstractProtocolServer("MyPrefix") {
+         override def start(properties: Properties, cacheManager: EmbeddedCacheManager) {
+            super.start(properties, cacheManager, 12345)
+         }
+
+         override def getEncoder: Encoder = null
+
+         override def getDecoder: Decoder = null
+      }
+   }
+
+}
\ No newline at end of file

Modified: branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala
===================================================================
--- branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -35,8 +35,10 @@
 
    override def getDecoder: Decoder = new HotRodDecoder(getCacheManager)
 
-   override def start(properties: Properties, cacheManager: EmbeddedCacheManager) {
-      super.start(properties, cacheManager)
+   override def start(p: Properties, cacheManager: EmbeddedCacheManager) {
+      val properties = if (p == null) new Properties else p
+      super.start(properties, cacheManager, 11311)
+      
       // Start defined caches to avoid issues with lazily started caches
       for (cacheName <- asIterator(cacheManager.getCacheNames.iterator))
          cacheManager.getCache(cacheName)
@@ -44,8 +46,8 @@
       isClustered = cacheManager.getGlobalConfiguration.getTransportClass != null
       // If clustered, set up a cache for topology information
       if (isClustered) {
-         val externalHost = properties.getProperty(PROP_KEY_PROXY_HOST, properties.getProperty(PROP_KEY_HOST))
-         val externalPort = properties.getProperty(PROP_KEY_PROXY_PORT, properties.getProperty(PROP_KEY_PORT)).toInt
+         val externalHost = properties.getProperty(PROP_KEY_PROXY_HOST, getHost)
+         val externalPort = properties.getProperty(PROP_KEY_PROXY_PORT, getPort.toString).toInt
          addSelfToTopologyView(externalHost, externalPort, cacheManager)
       }
    }

Modified: branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodProxyTest.scala
===================================================================
--- branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodProxyTest.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodProxyTest.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -11,7 +11,7 @@
 /**
  * // TODO: Document this
  * @author Galder Zamarreño
- * @since // TODO
+ * @since 4.1
  */
 @Test(groups = Array("functional"), testName = "server.hotrod.HotRodProxyTest")
 class HotRodProxyTest extends HotRodMultiNodeTest {

Added: branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodServerTest.scala
===================================================================
--- branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodServerTest.scala	                        (rev 0)
+++ branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/HotRodServerTest.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -0,0 +1,27 @@
+package org.infinispan.server.hotrod
+
+import org.testng.annotations.Test
+import org.infinispan.manager.DefaultCacheManager
+import org.testng.Assert._
+
+/**
+ * Hot Rod server unit test.
+ *
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+ at Test(groups = Array("functional"), testName = "server.hotrod.HotRodServerTest")
+class HotRodServerTest {
+
+   def testValidateProtocolServerNullProperties {
+      val server = new HotRodServer
+      try {
+         server.start(null, new DefaultCacheManager)
+         assertEquals(server.getHost, "127.0.0.1")
+         assertEquals(server.getPort, 11311)
+      } finally {
+         server.stop
+      }
+   }
+
+}
\ No newline at end of file

Modified: branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/test/HotRodTestingUtil.scala
===================================================================
--- branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/test/HotRodTestingUtil.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/hotrod/src/test/scala/org/infinispan/server/hotrod/test/HotRodTestingUtil.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -174,6 +174,6 @@
 } 
 
 object UniquePortThreadLocal extends ThreadLocal[Int] {
-   private val uniqueAddr = new AtomicInteger(11311)
+   private val uniqueAddr = new AtomicInteger(12311)
    override def initialValue: Int = uniqueAddr.getAndAdd(100)
 }

Modified: branches/4.1.x/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala
===================================================================
--- branches/4.1.x/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/memcached/src/main/scala/org/infinispan/server/memcached/MemcachedServer.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -2,8 +2,9 @@
 
 import org.infinispan.server.core.AbstractProtocolServer
 import org.infinispan.server.core.transport.{Decoder, Encoder}
-import org.infinispan.manager.CacheContainer
 import java.util.concurrent.{Executors, ScheduledExecutorService}
+import org.infinispan.manager.{EmbeddedCacheManager, CacheContainer}
+import java.util.Properties
 
 /**
  * // TODO: Document this
@@ -14,6 +15,11 @@
 
    protected lazy val scheduler = Executors.newScheduledThreadPool(1)
 
+   override def start(p: Properties, cacheManager: EmbeddedCacheManager) {
+      val properties = if (p == null) new Properties else p
+      super.start(properties, cacheManager, 11211)
+   }
+
    override def getEncoder: Encoder = null
 
    override def getDecoder: Decoder = new MemcachedDecoder(getCacheManager.getCache[String, MemcachedValue], scheduler)

Added: branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedServerTest.scala
===================================================================
--- branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedServerTest.scala	                        (rev 0)
+++ branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/MemcachedServerTest.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -0,0 +1,27 @@
+package org.infinispan.server.memcached
+
+import org.testng.annotations.Test
+import org.infinispan.manager.DefaultCacheManager
+import org.testng.Assert._
+
+/**
+ * Memcached server unit test.
+ *
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+ at Test(groups = Array("functional"), testName = "server.memcached.MemcachedServerTest")
+class MemcachedServerTest {
+
+   def testValidateProtocolServerNullProperties {
+      val server = new MemcachedServer
+      try {
+         server.start(null, new DefaultCacheManager)
+         assertEquals(server.getHost, "127.0.0.1")
+         assertEquals(server.getPort, 11211)
+      } finally {
+         server.stop
+      }
+   }
+
+}
\ No newline at end of file

Modified: branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/test/MemcachedTestingUtil.scala
===================================================================
--- branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/test/MemcachedTestingUtil.scala	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/memcached/src/test/scala/org/infinispan/server/memcached/test/MemcachedTestingUtil.scala	2010-07-15 08:35:33 UTC (rev 2035)
@@ -67,6 +67,6 @@
 }
 
 object UniquePortThreadLocal extends ThreadLocal[Int] {
-   private val uniqueAddr = new AtomicInteger(11211)
+   private val uniqueAddr = new AtomicInteger(12211)
    override def initialValue: Int = uniqueAddr.getAndAdd(100)
 }

Modified: branches/4.1.x/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java
===================================================================
--- branches/4.1.x/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java	2010-07-14 16:50:13 UTC (rev 2034)
+++ branches/4.1.x/server/websocket/src/main/java/org/infinispan/server/websocket/WebSocketServer.java	2010-07-15 08:35:33 UTC (rev 2035)
@@ -79,8 +79,11 @@
 
    @Override
    public void start(Properties properties, EmbeddedCacheManager cacheManager) {
-      String host = properties.getProperty("infinispan.server.host");
-      int port = Integer.parseInt(properties.getProperty("infinispan.server.port"));
+      if (properties == null)
+         properties = new Properties();
+
+      String host = properties.getProperty("infinispan.server.host", "127.0.0.1");
+      int port = Integer.parseInt(properties.getProperty("infinispan.server.port", "8181"));
       int masterThreads = Integer.parseInt(properties.getProperty("infinispan.server.master_threads"));
       int workerThreads = Integer.parseInt(properties.getProperty("infinispan.server.worker_threads"));
 



More information about the infinispan-commits mailing list