[jboss-cvs] JBoss Messaging SVN: r6173 - in trunk: tests/src/org/jboss/messaging/tests/integration/http and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 26 10:38:50 EDT 2009


Author: ataylor
Date: 2009-03-26 10:38:49 -0400 (Thu, 26 Mar 2009)
New Revision: 6173

Modified:
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
   trunk/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java
Log:
fixed netty http race condition

Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	2009-03-26 14:01:34 UTC (rev 6172)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java	2009-03-26 14:38:49 UTC (rev 6173)
@@ -21,25 +21,6 @@
  */
 package org.jboss.messaging.integration.transports.netty;
 
-import static org.jboss.netty.channel.Channels.pipeline;
-import static org.jboss.netty.channel.Channels.write;
-
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
-
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
@@ -59,6 +40,8 @@
 import org.jboss.netty.channel.ChannelPipelineCoverage;
 import org.jboss.netty.channel.ChannelPipelineFactory;
 import org.jboss.netty.channel.ChannelStateEvent;
+import static org.jboss.netty.channel.Channels.pipeline;
+import static org.jboss.netty.channel.Channels.write;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelHandler;
 import org.jboss.netty.channel.UpstreamMessageEvent;
@@ -82,6 +65,21 @@
 import org.jboss.netty.handler.codec.http.HttpVersion;
 import org.jboss.netty.handler.ssl.SslHandler;
 
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * A NettyConnector
  *
@@ -437,7 +435,7 @@
 
       private HttpIdleTimerTask task;
 
-      private String url;
+      private String url = "http://" + host + ":" + port + servletPath;
 
       private Future handShakeFuture = new Future();
 
@@ -455,7 +453,6 @@
       {
          super.channelConnected(ctx, e);
          channel = e.getChannel();
-         url = "http://" + host + ":" + port + servletPath;
          if (httpClientIdleScanPeriod > 0)
          {
             idleClientTimer = new Timer("Http Idle Timer", true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java	2009-03-26 14:01:34 UTC (rev 6172)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java	2009-03-26 14:38:49 UTC (rev 6173)
@@ -29,10 +29,13 @@
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptor;
 import org.jboss.messaging.integration.transports.netty.NettyConnector;
+import org.jboss.messaging.integration.transports.netty.TransportConstants;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
@@ -49,7 +52,7 @@
 
    // Commented out until https://jira.jboss.org/jira/browse/JBMESSAGING-1555 is fixed
    
-   /*public void testSendAndReceiveAtSameTime() throws Exception
+   public void testSendAndReceiveAtSameTime() throws Exception
    {
 
       int numPackets = 1000;
@@ -103,12 +106,8 @@
    {
       tearDown();
 
-      for (int k = 0; k < 2000; k++)
+      for (int k = 0; k < 20000; k++)
       {
-         System.out.println("-----------------------------------------------------");
-         System.out.println("-----------------------------------------------------");
-         System.out.println("-----------------------------------------------------");
-         System.out.println("-----------------------------------------------------");
          setUp();
          testSendOnly();
          tearDown();
@@ -403,7 +402,7 @@
          assertTrue(i == j);
          i++;
       }
-   }*/
+   }
 
    @Override
    protected void tearDown() throws Exception
@@ -524,6 +523,7 @@
 
       public void connectionException(Object connectionID, MessagingException me)
       {
+         me.printStackTrace();
       }
    }
 }




More information about the jboss-cvs-commits mailing list