[jboss-cvs] JBoss Messaging SVN: r2025 - in trunk: src/main/org/jboss/jms/client/remoting and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 23 08:25:10 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-01-23 08:25:10 -0500 (Tue, 23 Jan 2007)
New Revision: 2025

Added:
   trunk/src/main/org/jboss/jms/server/remoting/DirectThreadPool.java
   trunk/tests/src/org/jboss/test/thirdparty/remoting/DeliveryOrderTest.java
Removed:
   trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingEOFIssueTest.java
Modified:
   trunk/lib/jboss-remoting.jar
   trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-774

Modified: trunk/lib/jboss-remoting.jar
===================================================================
(Binary files differ)

Modified: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-01-23 10:37:21 UTC (rev 2024)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-01-23 13:25:10 UTC (rev 2025)
@@ -29,6 +29,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.remoting.Client;
 import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvoker;
 import org.jboss.remoting.callback.CallbackPoller;
 import org.jboss.remoting.transport.socket.MicroSocketClientInvoker;
 import org.jboss.remoting.transport.socket.SocketServerInvoker;
@@ -113,7 +114,9 @@
       if (doPushCallbacks)
       {
          if (log.isTraceEnabled()) log.trace("doing push callbacks");
+
          HashMap metadata = new HashMap();
+
          metadata.put(InvokerLocator.DATATYPE, "jms");
          // Not actually used at present - but it does no harm
          metadata.put(InvokerLocator.SERIALIZATIONTYPE, "jms");
@@ -121,7 +124,10 @@
                       "org.jboss.jms.client.remoting.ClientSocketWrapper");
          metadata.put(SocketServerInvoker.SERVER_SOCKET_CLASS_FLAG,
                       "org.jboss.jms.server.remoting.ServerSocketWrapper");
-         
+         // use our own direct thread pool that basically does nothing
+         metadata.put(ServerInvoker.ONEWAY_THREAD_POOL_CLASS_KEY,
+                      "org.jboss.jms.server.remoting.DirectThreadPool");
+
          String bindAddress = System.getProperty("jboss.messaging.callback.bind.address");
          if (bindAddress != null)
          {
@@ -142,7 +148,8 @@
 
          HashMap metadata = new HashMap();
 
-         // "jboss.messaging.callback.pollPeriod" system property, if set, has the highest priority ...
+         // "jboss.messaging.callback.pollPeriod" system property, if set, has the
+         // highest priority ...
          String callbackPollPeriod = System.getProperty("jboss.messaging.callback.pollPeriod");
          if (callbackPollPeriod == null)
          {

Added: trunk/src/main/org/jboss/jms/server/remoting/DirectThreadPool.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/remoting/DirectThreadPool.java	                        (rev 0)
+++ trunk/src/main/org/jboss/jms/server/remoting/DirectThreadPool.java	2007-01-23 13:25:10 UTC (rev 2025)
@@ -0,0 +1,81 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.server.remoting;
+
+import org.jboss.util.threadpool.ThreadPool;
+import org.jboss.util.threadpool.TaskWrapper;
+import org.jboss.util.threadpool.Task;
+
+/**
+ * A "noop" thread pool that just forwards the invocations, without doing any kind of pooling.
+ * We use it for the "socket" remoting callback server.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ * $Id$
+ */
+public class DirectThreadPool implements ThreadPool
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public DirectThreadPool()
+   {
+   }
+
+   // ThreadPool implementation --------------------------------------------------------------------
+
+   public void stop(boolean immediate)
+   {
+   }
+
+   public void waitForTasks() throws InterruptedException
+   {
+      throw new RuntimeException("NOT YET IMPLEMENTED!");
+   }
+
+   public void waitForTasks(long maxWaitTime) throws InterruptedException
+   {
+      throw new RuntimeException("NOT YET IMPLEMENTED!");
+   }
+
+   public void runTaskWrapper(TaskWrapper wrapper)
+   {
+      throw new RuntimeException("NOT YET IMPLEMENTED!");
+   }
+
+   public void runTask(Task task)
+   {
+      throw new RuntimeException("NOT YET IMPLEMENTED!");
+   }
+
+   public void run(Runnable runnable)
+   {
+      runnable.run();
+   }
+
+   public void run(Runnable runnable, long startTimeout, long completeTimeout)
+   {
+      throw new RuntimeException("NOT YET IMPLEMENTED!");
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


Property changes on: trunk/src/main/org/jboss/jms/server/remoting/DirectThreadPool.java
___________________________________________________________________
Name: svn:keywords
   + Id LastChangedDate Author Revision

Copied: trunk/tests/src/org/jboss/test/thirdparty/remoting/DeliveryOrderTest.java (from rev 2018, trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingEOFIssueTest.java)
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/DeliveryOrderTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/DeliveryOrderTest.java	2007-01-23 13:25:10 UTC (rev 2025)
@@ -0,0 +1,217 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.thirdparty.remoting;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+
+/**
+ * 
+ * A DeliveryOrderTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class DeliveryOrderTest extends MessagingTestCase
+{
+
+   public DeliveryOrderTest(String name)
+   {
+      super(name);
+   }
+
+   private ConnectionFactory cf;
+   
+   private Queue queue;
+   
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      ServerManagement.start("all");
+      
+      ServerManagement.deployQueue("testQueue");
+      
+      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+      
+      cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      
+      queue = (Queue)ic.lookup("/queue/testQueue");
+      
+      this.drainDestination(cf, queue);
+      
+      ic.close();
+      
+   }
+
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+      
+      ServerManagement.undeployQueue("testQueue");
+      
+      ServerManagement.stop();
+   }
+   
+   public void testOutOfOrder() throws Exception
+   {
+      Connection conn = null;
+      try
+      {
+         conn = cf.createConnection();
+         
+         Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+         
+         Session sess2 = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageProducer prod = sess.createProducer(queue);
+         
+         MessageConsumer cons = sess2.createConsumer(queue);
+         
+         Latch latch = new Latch();
+         
+         final int NUM_MESSAGES = 2000;
+                  
+         MyListener listener = new MyListener(latch, NUM_MESSAGES);
+         
+         cons.setMessageListener(listener);
+         
+         conn.start();
+         
+         for (int i = 0; i < NUM_MESSAGES; i++)
+         {
+            TextMessage tm = sess.createTextMessage("message" + i);
+            
+            prod.send(tm);
+            
+            if (i % 10 == 0)
+            {
+               sess.commit();
+            }
+         }
+
+         // need extra commit for cases in which the last message index is not a multiple of 10
+         sess.commit();
+
+         latch.acquire();
+         
+         if (listener.failed)
+         {
+            fail("listener failed: " + listener.getError());
+         }
+                  
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+   
+   class MyListener implements MessageListener
+   {
+      private int c;
+      private int num;
+      private Latch latch;
+      private volatile boolean failed;
+      private String error;
+
+      MyListener(Latch latch, int num)
+      {
+         this.latch = latch;
+         this.num = num;
+      }
+
+      public void onMessage(Message msg)
+      {
+         // preserve the first error
+         if (failed)
+         {
+            return;
+         }
+
+         try
+         {
+            TextMessage tm = (TextMessage)msg;
+            
+            log.debug("got " + tm.getText());
+            
+            if (!("message" + c).equals(tm.getText()))
+            {
+               // Failed
+               failed = true;
+               setError("Listener was supposed to get " + ("message" + c) +
+                        " but got " + tm.getText());
+               latch.release();
+            }
+            
+            c++;
+            
+            if (c == num)
+            {
+               latch.release();
+            }
+         }
+         catch (JMSException e)
+         {
+            e.printStackTrace();
+            
+            // Failed
+            failed = true;
+            setError("Listener got exception " + e.toString());
+            latch.release();
+         }
+      }
+
+      public synchronized String getError()
+      {
+         return error;
+      }
+
+      private synchronized void setError(String s)
+      {
+         error = s;
+      }
+
+      
+   }
+
+}

Deleted: trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingEOFIssueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingEOFIssueTest.java	2007-01-23 10:37:21 UTC (rev 2024)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingEOFIssueTest.java	2007-01-23 13:25:10 UTC (rev 2025)
@@ -1,199 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.thirdparty.remoting;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-import EDU.oswego.cs.dl.util.concurrent.Latch;
-
-/**
- * 
- * A RemotingEOFIssueTest
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class RemotingEOFIssueTest extends MessagingTestCase
-{
-
-   public RemotingEOFIssueTest(String name)
-   {
-      super(name);
-   }
-
-   private ConnectionFactory cf;
-   
-   private Queue queue;
-   
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      
-      ServerManagement.start("all");
-      
-      ServerManagement.deployQueue("testQueue");
-      
-      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-      
-      cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      
-      queue = (Queue)ic.lookup("/queue/testQueue");
-      
-      this.drainDestination(cf, queue);
-      
-      ic.close();
-      
-   }
-
-   protected void tearDown() throws Exception
-   {
-      super.tearDown();
-      
-      ServerManagement.undeployQueue("testQueue");
-      
-      ServerManagement.stop();
-   }
-   
-   public void testOutOfOrder() throws Exception
-   {
-      Connection conn = null;
-      try
-      {
-         conn = cf.createConnection();
-         
-         Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
-         
-         Session sess2 = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageProducer prod = sess.createProducer(queue);
-         
-         MessageConsumer cons = sess2.createConsumer(queue);
-         
-         Latch latch = new Latch();
-         
-         final int NUM_MESSAGES = 2000;
-                  
-         MyListener listener = new MyListener(latch, NUM_MESSAGES);
-         
-         cons.setMessageListener(listener);
-         
-         conn.start();
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess.createTextMessage("message" + i);
-            
-            prod.send(tm);
-            
-            if (i % 10 == 0)
-            {
-               sess.commit();
-            }
-         }
-         
-         latch.acquire();
-         
-         if (listener.failed)
-         {
-            fail();
-         }
-                  
-      }
-      finally
-      {
-         if (conn != null)
-         {
-            conn.close();
-         }
-      }
-   }
-   
-   class MyListener implements MessageListener
-   {
-      int c;
-      
-      Latch latch;
-      
-      int num;
-      
-      volatile boolean failed;
-      
-      MyListener(Latch latch, int num)
-      {
-         this.latch = latch;
-         
-         this.num = num;
-      }
-
-      public void onMessage(Message msg)
-      {
-         try
-         {
-            TextMessage tm = (TextMessage)msg;
-            
-            log.info("Got message " + tm.getText());
-            
-            if (!("message" + c).equals(tm.getText()))
-            {
-               //Failed
-               failed = true;
-
-               latch.release();
-            }
-            
-            c++;
-            
-            if (c == num)
-            {
-               latch.release();
-            }
-         }
-         catch (JMSException e)
-         {
-            e.printStackTrace();
-            
-            //Failed
-            failed = true;
-            
-            latch.release();              
-         }
-      }
-      
-   }
-
-}




More information about the jboss-cvs-commits mailing list