[jboss-cvs] JBoss Messaging SVN: r6988 - in trunk: examples/core/perf/server0 and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 22 04:28:21 EDT 2009


Author: timfox
Date: 2009-05-22 04:28:21 -0400 (Fri, 22 May 2009)
New Revision: 6988

Modified:
   trunk/examples/core/perf/perf.properties
   trunk/examples/core/perf/server0/jbm-configuration.xml
   trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java
   trunk/examples/core/perf/src/org/jboss/core/example/PerfParams.java
   trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java
Log:
perf stuff

Modified: trunk/examples/core/perf/perf.properties
===================================================================
--- trunk/examples/core/perf/perf.properties	2009-05-22 07:51:33 UTC (rev 6987)
+++ trunk/examples/core/perf/perf.properties	2009-05-22 08:28:21 UTC (rev 6988)
@@ -7,4 +7,8 @@
 drain-queue=true
 queue-name=perfQueue
 throttle-rate=-1
-address=perfAddress
\ No newline at end of file
+address=perfAddress
+host=localhost
+port=5445
+tcp-buffer=1048576
+tcp-no-delay=false
\ No newline at end of file

Modified: trunk/examples/core/perf/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/core/perf/server0/jbm-configuration.xml	2009-05-22 07:51:33 UTC (rev 6987)
+++ trunk/examples/core/perf/server0/jbm-configuration.xml	2009-05-22 08:28:21 UTC (rev 6988)
@@ -8,8 +8,8 @@
       <acceptor name="netty-acceptor">
          <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>    
          <param key="jbm.remoting.netty.tcpnodelay" value="false" type="Boolean"/>
-         <param key="jbm.remoting.netty.tcpsendbuffersize" value="1048576" type="Boolean"/>
-         <param key="jbm.remoting.netty.tcpreceivebuffersize" value="1048576" type="Boolean"/>
+         <param key="jbm.remoting.netty.tcpsendbuffersize" value="1048576" type="Integer"/>
+         <param key="jbm.remoting.netty.tcpreceivebuffersize" value="1048576" type="Integer"/>
       </acceptor>
    </acceptors>
    

Modified: trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java
===================================================================
--- trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java	2009-05-22 07:51:33 UTC (rev 6987)
+++ trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java	2009-05-22 08:28:21 UTC (rev 6988)
@@ -87,6 +87,10 @@
       String queueName = props.getProperty("queue-name");
       String address = props.getProperty("address");
       int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
+      String host = props.getProperty("host");
+      int port = Integer.valueOf(props.getProperty("port"));
+      int tcpBufferSize = Integer.valueOf(props.getProperty("tcp-buffer"));
+      boolean tcpNoDelay = Boolean.valueOf(props.getProperty("tcp-no-delay"));
 
       log.info("num-messages: " + noOfMessages);
       log.info("num-warmup-messages: " + noOfWarmupMessages);
@@ -97,6 +101,10 @@
       log.info("drain-queue: " + drainQueue);
       log.info("address: " + address);
       log.info("throttle-rate: " + throttleRate);
+      log.info("host:" + host);
+      log.info("port: " + port);
+      log.info("tcp buffer: " + tcpBufferSize);
+      log.info("tcp no delay: " + tcpNoDelay);
 
       PerfParams perfParams = new PerfParams();
       perfParams.setNoOfMessagesToSend(noOfMessages);
@@ -109,6 +117,10 @@
       perfParams.setQueueName(queueName);
       perfParams.setAddress(address);
       perfParams.setThrottleRate(throttleRate);
+      perfParams.setHost(host);
+      perfParams.setPort(port);
+      perfParams.setTcpBufferSize(tcpBufferSize);
+      perfParams.setTcpNoDelay(tcpNoDelay);
 
       return perfParams;
    }
@@ -130,9 +142,12 @@
    {
       Map<String, Object> params = new HashMap<String, Object>();
 
-      params.put(TransportConstants.TCP_NODELAY_PROPNAME, false);
-      params.put(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, 1024 * 1024);
-      params.put(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, 1024 * 1024);
+      params.put(TransportConstants.TCP_NODELAY_PROPNAME, perfParams.isTcpNoDelay());
+      params.put(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, perfParams.getTcpBufferSize());
+      params.put(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, perfParams.getTcpBufferSize());
+      
+      params.put(TransportConstants.HOST_PROP_NAME, perfParams.getHost());
+      params.put(TransportConstants.PORT_PROP_NAME, perfParams.getPort());
 
       factory = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName(), params));
       factory.setPreAcknowledge(true);

Modified: trunk/examples/core/perf/src/org/jboss/core/example/PerfParams.java
===================================================================
--- trunk/examples/core/perf/src/org/jboss/core/example/PerfParams.java	2009-05-22 07:51:33 UTC (rev 6987)
+++ trunk/examples/core/perf/src/org/jboss/core/example/PerfParams.java	2009-05-22 08:28:21 UTC (rev 6988)
@@ -43,7 +43,11 @@
    private String queueName = "perfQueue";  
    private String address = "perfAddress";
    private int throttleRate;
-
+   private String host;
+   private int port;
+   private int tcpBufferSize;
+   private boolean tcpNoDelay;
+     
    public int getNoOfMessagesToSend()
    {
       return noOfMessagesToSend;
@@ -153,5 +157,45 @@
               ", Throttle rate = " + throttleRate;
    }
 
+   public synchronized String getHost()
+   {
+      return host;
+   }
 
+   public synchronized void setHost(String host)
+   {
+      this.host = host;
+   }
+
+   public synchronized int getPort()
+   {
+      return port;
+   }
+
+   public synchronized void setPort(int port)
+   {
+      this.port = port;
+   }
+
+   public synchronized int getTcpBufferSize()
+   {
+      return tcpBufferSize;
+   }
+
+   public synchronized void setTcpBufferSize(int tcpBufferSize)
+   {
+      this.tcpBufferSize = tcpBufferSize;
+   }
+
+   public synchronized boolean isTcpNoDelay()
+   {
+      return tcpNoDelay;
+   }
+
+   public synchronized void setTcpNoDelay(boolean tcpNoDelay)
+   {
+      this.tcpNoDelay = tcpNoDelay;
+   }
+
+
 }

Modified: trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java	2009-05-22 07:51:33 UTC (rev 6987)
+++ trunk/src/main/org/jboss/messaging/utils/ConfigurationHelper.java	2009-05-22 08:28:21 UTC (rev 6988)
@@ -34,17 +34,16 @@
 public class ConfigurationHelper
 {
    public static final Logger log = Logger.getLogger(ConfigurationHelper.class);
-   
-   public static String getStringProperty(final String propName, final String def,
-                                          final Map<String, Object> props)
+
+   public static String getStringProperty(final String propName, final String def, final Map<String, Object> props)
    {
       if (props == null)
       {
          return def;
       }
-      
+
       Object prop = props.get(propName);
-      
+
       if (prop == null)
       {
          return def;
@@ -59,11 +58,10 @@
          {
             return (String)prop;
          }
-      }      
+      }
    }
-   
-   public static int getIntProperty(final String propName, final int def,
-                                    final Map<String, Object> props)
+
+   public static int getIntProperty(final String propName, final int def, final Map<String, Object> props)
    {
       if (props == null)
       {
@@ -82,10 +80,9 @@
          {
             return Integer.valueOf((String)prop);
          }
-         else
-         if (prop instanceof Integer == false)
+         else if (prop instanceof Integer == false)
          {
-            log.warn("Property " + propName + " must be an Integer");
+            log.warn("Property " + propName + " must be an Integer, it is " + prop.getClass().getName());
 
             return def;
          }
@@ -93,17 +90,16 @@
          {
             return (Integer)prop;
          }
-      }      
+      }
    }
-   
-   public static long getLongProperty(final String propName, final long def,
-                                     final Map<String, Object> props)
+
+   public static long getLongProperty(final String propName, final long def, final Map<String, Object> props)
    {
       if (props == null)
       {
          return def;
       }
-      
+
       Object prop = props.get(propName);
 
       if (prop == null)
@@ -117,10 +113,9 @@
          {
             return Long.valueOf((String)prop);
          }
-         else
-         if (prop instanceof Long == false)
+         else if (prop instanceof Long == false)
          {
-            log.warn("Property " + propName + " must be an Long");
+            log.warn("Property " + propName + " must be an Long, it is " + prop.getClass().getName());
 
             return def;
          }
@@ -128,17 +123,16 @@
          {
             return (Long)prop;
          }
-      }      
+      }
    }
-   
-   public static boolean getBooleanProperty(final String propName, final boolean def,
-            final Map<String, Object> props)
+
+   public static boolean getBooleanProperty(final String propName, final boolean def, final Map<String, Object> props)
    {
       if (props == null)
       {
          return def;
       }
-      
+
       Object prop = props.get(propName);
 
       if (prop == null)
@@ -152,10 +146,9 @@
          {
             return Boolean.valueOf((String)prop);
          }
-         else
-         if (prop instanceof Boolean == false)
+         else if (prop instanceof Boolean == false)
          {
-            log.warn("Property " + propName + " must be a Boolean");
+            log.warn("Property " + propName + " must be a Boolean, it is " + prop.getClass().getName());
 
             return def;
          }
@@ -163,6 +156,6 @@
          {
             return (Boolean)prop;
          }
-      }      
+      }
    }
 }




More information about the jboss-cvs-commits mailing list