[jboss-svn-commits] JBL Code SVN: r13919 - labs/jbossesb/trunk/product/samples/quickstarts/webservice_consumer1/src/org/jboss/soa/esb/samples/quickstart/webservice_consumer1/test.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jul 31 15:22:39 EDT 2007


Author: james.williams at jboss.com
Date: 2007-07-31 15:22:39 -0400 (Tue, 31 Jul 2007)
New Revision: 13919

Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_consumer1/src/org/jboss/soa/esb/samples/quickstart/webservice_consumer1/test/SendEsbMessage.java
Log:
fixed a connection cleanup issue.

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_consumer1/src/org/jboss/soa/esb/samples/quickstart/webservice_consumer1/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_consumer1/src/org/jboss/soa/esb/samples/quickstart/webservice_consumer1/test/SendEsbMessage.java	2007-07-31 17:54:36 UTC (rev 13918)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_consumer1/src/org/jboss/soa/esb/samples/quickstart/webservice_consumer1/test/SendEsbMessage.java	2007-07-31 19:22:39 UTC (rev 13919)
@@ -24,6 +24,7 @@
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
 
 public class SendEsbMessage
 {
@@ -33,25 +34,35 @@
     */
    private void sendMessage(String message) throws Exception
    {
-      try
-      {
-         System.setProperty("javax.xml.registry.ConnectionFactoryClass",
-               "org.apache.ws.scout.registry.ConnectionFactoryImpl");
+      // Create the delivery adapter for the target service (cache it)
+      System.setProperty("javax.xml.registry.ConnectionFactoryClass",
+            "org.apache.ws.scout.registry.ConnectionFactoryImpl");
 
-         // Create the delivery adapter for the target service (cache it)
-         ServiceInvoker deliveryAdapter = new ServiceInvoker(
-               "MyServiceCategory", "WebserviceConsumer1");
+      // Create the delivery adapter for the target service (cache it)
+      ServiceInvoker deliveryAdapter = new ServiceInvoker("MyServiceCategory",
+            "WebserviceConsumer1");
 
-         // Create and populate the request message...
-         Message requestMessage = MessageFactory.getInstance().getMessage(
-               MessageType.JBOSS_XML);
+      // Create and populate the request message...
+      Message requestMessage = MessageFactory.getInstance().getMessage(
+            MessageType.JBOSS_XML);
 
-         requestMessage.getBody().add(message);
+      requestMessage.getBody().add(message);
 
-         // Deliver the request message synchronously - timeout after 20
-         // seconds...
-         Message replyMessage = deliveryAdapter.deliverSync(requestMessage,
-               20000);
+      // Deliver the request message synchronously - timeout after 20
+      // seconds...
+      Message replyMessage = deliveryAdapter.deliverSync(requestMessage, 20000);
+      
+      //need to cleanup connection pool for service invoker
+      cleanupConnection();
+   }
+   
+    private void cleanupConnection()
+   {
+      try
+      {
+         //This static call is kind of clunky because the gateway might not be JMS based.
+         //But, the JMS gateway is the only gateway that currently has a connection pool.
+         JmsConnectionPoolContainer.removeAllPools();
       } catch (Exception e)
       {
          e.printStackTrace();




More information about the jboss-svn-commits mailing list