[infinispan-commits] Infinispan SVN: r2098 - trunk/server/core/src/main/scala/org/infinispan/server/core.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Jul 26 12:12:31 EDT 2010


Author: galder.zamarreno at jboss.com
Date: 2010-07-26 12:12:30 -0400 (Mon, 26 Jul 2010)
New Revision: 2098

Modified:
   trunk/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala
   trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala
Log:
[ISPN-550] (Unnecessary parameter invalidation in server Main class leading to errors) Fixed.

Modified: trunk/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala
===================================================================
--- trunk/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala	2010-07-26 15:42:22 UTC (rev 2097)
+++ trunk/server/core/src/main/scala/org/infinispan/server/core/AbstractProtocolServer.scala	2010-07-26 16:12:30 UTC (rev 2098)
@@ -25,6 +25,7 @@
 
    def start(properties: Properties, cacheManager: EmbeddedCacheManager, defaultPort: Int) {
       val typedProps = TypedProperties.toTypedProperties(properties)
+      // Enabled added to make it easy to enable/disable endpoints in JBoss MC based beans for EDG
       val toStart = typedProps.getBooleanProperty("enabled", true)
 
       if (toStart) {

Modified: trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala
===================================================================
--- trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-26 15:42:22 UTC (rev 2097)
+++ trunk/server/core/src/main/scala/org/infinispan/server/core/Main.scala	2010-07-26 16:12:30 UTC (rev 2098)
@@ -80,45 +80,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"
@@ -127,28 +94,11 @@
       }
       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.
+      // Removing Infinispan's hook also makes shutdown procedures for server and cache manager sequential, avoiding
+      // issues with having the JGroups channel disconnected before it's removed itself from the topology view.
       addShutdownHook(new ShutdownHook(server, cacheManager))
       server.start(props, cacheManager)
    }



More information about the infinispan-commits mailing list