[jboss-cvs] JBoss Messaging SVN: r7576 - in trunk: tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 15 10:03:24 EDT 2009


Author: jmesnil
Date: 2009-07-15 10:03:24 -0400 (Wed, 15 Jul 2009)
New Revision: 7576

Modified:
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
Log:
Netty Acceptor start/stop

* in NettyAcceptor.stop(), call pause() if the acceptor is not already stopped (this adds a 500ms sleep)
* in NettyAcceptorTest.testStartStop(), check that netty port is free after every time the acceptor is stopped 

Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	2009-07-15 13:24:00 UTC (rev 7575)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	2009-07-15 14:03:24 UTC (rev 7576)
@@ -373,20 +373,7 @@
       
       if (!paused)
       {
-         ChannelGroupFuture future = serverChannelGroup.close().awaitUninterruptibly();
-         if (!future.isCompleteSuccess())
-         {
-            log.warn("Server channel group did not completely close");
-            Iterator<Channel> iterator = future.getGroup().iterator();
-            while (iterator.hasNext())
-            {
-               Channel channel = (Channel)iterator.next();
-               if (channel.isBound())
-               {
-                  log.warn(channel + " is still bound to " + channel.getLocalAddress());
-               }
-            }
-         }
+         pause();
       }
 
       if (httpKeepAliveRunnable != null)

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2009-07-15 13:24:00 UTC (rev 7575)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2009-07-15 14:03:24 UTC (rev 7576)
@@ -94,14 +94,16 @@
 
       acceptor.start();
       assertTrue(acceptor.isStarted());
-      acceptor.pause();
       acceptor.stop();
-      assertFalse(acceptor.isStarted());
+      assertFalse(acceptor.isStarted());      
+      checkFreePort(TransportConstants.DEFAULT_PORT);
+      
       acceptor.start();
       assertTrue(acceptor.isStarted());
       acceptor.pause();
       acceptor.stop();
       assertFalse(acceptor.isStarted());
+      checkFreePort(TransportConstants.DEFAULT_PORT);
 
       acceptor.start();
       assertTrue(acceptor.isStarted());
@@ -109,10 +111,12 @@
       acceptor.resume();
       acceptor.stop();
       assertFalse(acceptor.isStarted());
+      checkFreePort(TransportConstants.DEFAULT_PORT);
+
       acceptor.start();
       assertTrue(acceptor.isStarted());
       acceptor.stop();
       assertFalse(acceptor.isStarted());
-
+      checkFreePort(TransportConstants.DEFAULT_PORT);
    }
 }




More information about the jboss-cvs-commits mailing list