[jboss-cvs] JBoss Messaging SVN: r7094 - in trunk: examples/jms/perf/src/org/jboss/jms/example and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 28 09:26:47 EDT 2009


Author: timfox
Date: 2009-05-28 09:26:47 -0400 (Thu, 28 May 2009)
New Revision: 7094

Modified:
   trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java
   trunk/examples/jms/perf/src/org/jboss/jms/example/PerfBase.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
Log:
fixed netty issue + some tweaks to perf

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-28 12:32:08 UTC (rev 7093)
+++ trunk/examples/core/perf/src/org/jboss/core/example/PerfBase.java	2009-05-28 13:26:47 UTC (rev 7094)
@@ -26,6 +26,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Random;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
@@ -57,6 +58,20 @@
    
    private static final String DEFAULT_PERF_PROPERTIES_FILE_NAME = "perf.properties";
    
+   private static byte[] randomByteArray(final int length)
+   {
+      byte[] bytes = new byte[length];
+      
+      Random random = new Random();
+      
+      for (int i = 0; i < length; i++)
+      {
+         bytes[i] = Integer.valueOf(random.nextInt()).byteValue();
+      }
+      
+      return bytes;      
+   }
+   
    protected static String getPerfFileName(String[] args)
    {
       String fileName;
@@ -329,7 +344,7 @@
 
       ClientMessage message = session.createClientMessage(durable);
 
-      byte[] payload = new byte[messageSize];
+      byte[] payload = randomByteArray(messageSize);
 
       message.getBody().writeBytes(payload);
 

Modified: trunk/examples/jms/perf/src/org/jboss/jms/example/PerfBase.java
===================================================================
--- trunk/examples/jms/perf/src/org/jboss/jms/example/PerfBase.java	2009-05-28 12:32:08 UTC (rev 7093)
+++ trunk/examples/jms/perf/src/org/jboss/jms/example/PerfBase.java	2009-05-28 13:26:47 UTC (rev 7094)
@@ -24,6 +24,7 @@
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.Properties;
+import java.util.Random;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
@@ -56,6 +57,20 @@
    private static final Logger log = Logger.getLogger(PerfSender.class.getName());
 
    private static final String DEFAULT_PERF_PROPERTIES_FILE_NAME = "perf.properties";
+   
+   private static byte[] randomByteArray(final int length)
+   {
+      byte[] bytes = new byte[length];
+      
+      Random random = new Random();
+      
+      for (int i = 0; i < length; i++)
+      {
+         bytes[i] = Integer.valueOf(random.nextInt()).byteValue();
+      }
+      
+      return bytes;      
+   }
 
    protected static String getPerfFileName(String[] args)
    {
@@ -326,7 +341,7 @@
 
       BytesMessage message = session.createBytesMessage();
 
-      byte[] payload = new byte[messageSize];
+      byte[] payload = randomByteArray(messageSize);
 
       message.writeBytes(payload);
 

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java	2009-05-28 12:32:08 UTC (rev 7093)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java	2009-05-28 13:26:47 UTC (rev 7094)
@@ -1751,7 +1751,14 @@
          }
          else if (type == PacketImpl.DISCONNECT)
          {
-            fail(new MessagingException(MessagingException.DISCONNECTED, "The connection was closed by the server"));
+            threadPool.execute(new Runnable()
+            {
+               public void run()
+               {
+                  fail(new MessagingException(MessagingException.DISCONNECTED, "The connection was closed by the server")); 
+               }
+            });     
+            //fail(new MessagingException(MessagingException.DISCONNECTED, "The connection was closed by the server"));
          }
          else
          {

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java	2009-05-28 12:32:08 UTC (rev 7093)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java	2009-05-28 13:26:47 UTC (rev 7094)
@@ -206,8 +206,15 @@
       }
 
       public void connectionException(final Object connectionID, final MessagingException me)
-      {
-         listener.connectionException(connectionID, me);
+      {                  
+         // Execute on different thread to avoid deadlocks
+         new Thread()
+         {
+            public void run()
+            {
+               listener.connectionException(connectionID, me);       
+            }
+         }.start();
       }
 
    }




More information about the jboss-cvs-commits mailing list