[jboss-cvs] JBoss Messaging SVN: r6530 - in trunk: examples/jms and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 23 05:47:30 EDT 2009


Author: jmesnil
Date: 2009-04-23 05:47:30 -0400 (Thu, 23 Apr 2009)
New Revision: 6530

Added:
   trunk/examples/jms/client-kickoff/
   trunk/examples/jms/client-kickoff/build.xml
   trunk/examples/jms/client-kickoff/readme.html
   trunk/examples/jms/client-kickoff/server0/
   trunk/examples/jms/client-kickoff/server0/client-jndi.properties
   trunk/examples/jms/client-kickoff/server0/jbm-configuration.xml
   trunk/examples/jms/client-kickoff/server0/jbm-jms.xml
   trunk/examples/jms/client-kickoff/server0/jbm-queues.xml
   trunk/examples/jms/client-kickoff/server0/jbm-standalone-beans.xml
   trunk/examples/jms/client-kickoff/server0/jbm-users.xml
   trunk/examples/jms/client-kickoff/src/
   trunk/examples/jms/client-kickoff/src/org/
   trunk/examples/jms/client-kickoff/src/org/jboss/
   trunk/examples/jms/client-kickoff/src/org/jboss/jms/
   trunk/examples/jms/client-kickoff/src/org/jboss/jms/example/
   trunk/examples/jms/client-kickoff/src/org/jboss/jms/example/ClientKickoffExample.java
Modified:
   trunk/.classpath
   trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java
Log:
Client Kickoff example

* this examples shows how to kick off a client connected to JBoss Messaging using JMX

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2009-04-23 09:43:18 UTC (rev 6529)
+++ trunk/.classpath	2009-04-23 09:47:30 UTC (rev 6530)
@@ -18,6 +18,7 @@
 	<classpathentry kind="src" path="examples/jms/automatic-failover/src"/>
 	<classpathentry kind="src" path="examples/jms/bridge/src"/>
 	<classpathentry kind="src" path="examples/jms/browser/src"/>
+	<classpathentry kind="src" path="examples/jms/client-kickoff/src"/>
 	<classpathentry kind="src" path="examples/jms/client-side-load-balancing/src"/>
 	<classpathentry kind="src" path="examples/jms/clustered-durable-subscription/src"/>
 	<classpathentry kind="src" path="examples/jms/clustered-queue/src"/>


Property changes on: trunk/examples/jms/client-kickoff
___________________________________________________________________
Name: svn:ignore
   + build
logs


Added: trunk/examples/jms/client-kickoff/build.xml
===================================================================
--- trunk/examples/jms/client-kickoff/build.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/build.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging Client Kickoff Example">
+
+   <import file="../common/build.xml"/>
+
+    <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.ClientKickoffExample"/>
+      </antcall>
+   </target>
+
+   <target name="runRemote">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.ClientKickoffExample"/>
+         <param name="jbm.example.runServer" value="false"/>
+      </antcall>
+   </target>
+
+</project>

Added: trunk/examples/jms/client-kickoff/readme.html
===================================================================
--- trunk/examples/jms/client-kickoff/readme.html	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/readme.html	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,139 @@
+<html>
+  <head>
+    <title>JBoss Messaging Client Kickoff Example</title>
+    <link rel="stylesheet" type="text/css" href="../common/common.css">
+  </head>
+  <body>
+     <h1>Client Kickoff Example</h1>
+
+     <p>This example shows how to kick off a client connected to JBoss Messaging 
+         using <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">JMX</a></p>
+
+     <p>The example will connect to JBoss Messaging. Using JMX, we will list the remote addresses connected to the 
+         server and close the corresponding connections. The client will be kicked off from JBoss Messaging and receives
+         an exception that its JMS connection was interrupted.</p>
+
+     <h2>Example configuration</h2>
+
+     <p>JBoss Messaging exposes its managed resources by default on the platform MBeanServer.</p>
+     <p>To access this MBeanServer remotely, the Java Virtual machine must be started with system properties:
+         <pre>
+             <code>-Dcom.sun.management.jmxremote
+             -Dcom.sun.management.jmxremote.port=3000
+             -Dcom.sun.management.jmxremote.ssl=false
+             -Dcom.sun.management.jmxremote.authenticate=false</code>
+        </pre>
+        <p>These properties are explained in the Java 5 <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#remote">Management guide</a>
+            (please note that for this example, we will disable user authentication for simplicity sake).</p>        
+        <p>With these properties, JBoss Messaging server will be manageable remotely using standard JMX URL on port <code>3000</code>.</p> 
+     </p>
+         
+     <h2>Example step-by-step</h2>
+     <p><em>To run the example, simply type <code>ant</code> from this directory</em></p>
+     <ol>
+        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get its properties from <a href="server0/client-jndi.properties">client-jndi.properties</a></li>
+        <pre>
+            <code>InitialContext initialContext = getContext(0);</code>
+        </pre>
+
+        <li>We look up the JMS connection factory object from JNDI</li>
+        <pre>
+            <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
+        </pre>
+
+        <li>We create a JMS connection</li>
+        <pre>
+            <code>connection = cf.createConnection();</code>
+        </pre>
+        
+        <li>We set a <code>ExceptionListener</code> on the connection to be notified after a problem occurred</li>
+        <pre>
+            <code>final AtomicReference&lt;JMSException&gt; exception = new AtomicReference&lt;JMSException&gt;();
+            connection.setExceptionListener(new ExceptionListener()
+            {
+               public void onException(JMSException e)
+               {
+                  exception.set(e);
+               }
+            });</code>
+        </pre>
+
+        <li>We start the connection</li>
+        <pre>
+            <code>connection.start();</code>
+       </pre>
+
+        <li>We create a MBean proxy to the MessagingServerControlMBean used to manage JBoss Messaging server
+            (see <a href="../jmx/readme.html">JMX example</a> for a complete explanation of the different steps)</li>
+        <pre>
+            <code>ObjectName on = ObjectNames.getMessagingServerObjectName();
+            JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, String>());
+            MBeanServerConnection mbsc = connector.getMBeanServerConnection();
+            MessagingServerControlMBean serverControl = (MessagingServerControlMBean)MBeanServerInvocationHandler.newProxyInstance(mbsc,
+                                                                                                on,
+                                                                                                MessagingServerControlMBean.class,
+                                                                                                false);
+            </code>
+        </pre>
+
+        <li>Using the server MBean, we list the remote address connected to the server</li>
+        <pre>
+            <code>String[] remoteAddresses = serverControl.listRemoteAddresses();
+            for (String remoteAddress : remoteAddresses)
+            {
+               System.out.println(remoteAddress);
+            }
+            </code>
+        </pre>
+
+        <p>It will display a single address corresponding to the connection opened at step 3.</p>
+            
+        <li>We close the connections corresponding to this remote address</li>
+        <pre>
+              <code>serverControl.closeConnectionsForAddress(remoteAddresses[0]);</code>
+        </pre>
+
+        <p>Warnings be displayed on the server output:</p>
+        <pre>
+            <code>org.jboss.jms.example.SpawnedJMSServer out:11:22:33,034 WARN  @RMI TCP Connection(3)-192.168.0.10 [RemotingConnectionImpl] Connection failure has been detected connections for /192.168.0.10:52707 closed by management:0
+            org.jboss.jms.example.SpawnedJMSServer out:11:22:33,035 WARN  @RMI TCP Connection(3)-192.168.0.10 [ServerSessionImpl] Client connection failed, clearing up resources for session 4646da35-2fe8-11de-9ce9-752ccc2b26e4
+            org.jboss.jms.example.SpawnedJMSServer out:11:22:33,035 WARN  @RMI TCP Connection(3)-192.168.0.10 [ServerSessionImpl] Cleared up resources for session 4646da35-2fe8-11de-9ce9-752ccc2b26e4
+            </code>
+        </pre>
+        
+        <li>We display the exception received by the connection's ExceptionListener</li>
+        <pre>
+            <code>exception.get().printStackTrace();</code>
+        </pre>
+        
+        <p>When the connection was closed on the server-side by the call to <code>serverControl.closeConnectionsForAddress()</code>, 
+        the client's connection was disconnected and its exception listener was notified.</p>
+        
+        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
+
+        <pre>
+           <code>finally
+           {
+              if (initialContext != null)
+              {
+                initialContext.close();
+              }
+              if (connection != null)
+              {
+                 connection.close();
+              }
+           }</code>
+        </pre>
+     </ol>
+                
+     <h2>More information</h2>
+     
+     <ul>
+        <li><a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html">Java 5 Management guide</a></li>
+        <li>JBoss Messaging defines a set of MBeans for this core 
+            API (<a href="../../../docs/api/org/jboss/messaging/core/management/package-summary.html">org.jboss.messaging.core.management</a>
+             package) and its JMS API (in the <a href="../../../docs/api/org/jboss/messaging/jms/server/management/package-summary.html">org.jboss.messaging.jms.server.management</a> package)
+        <li><a href="../../../docs/api/org/jboss/messaging/core/management/ObjectNames.html">ObjectNames</a> is a helper class used to build the ObjectName of JBoss Messaging manageable resources</li>
+     </ul>
+  </body>
+</html>
\ No newline at end of file


Property changes on: trunk/examples/jms/client-kickoff/server0
___________________________________________________________________
Name: svn:ignore
   + data
logs


Added: trunk/examples/jms/client-kickoff/server0/client-jndi.properties
===================================================================
--- trunk/examples/jms/client-kickoff/server0/client-jndi.properties	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/client-jndi.properties	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: trunk/examples/jms/client-kickoff/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/client-kickoff/server0/jbm-configuration.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/jbm-configuration.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,31 @@
+<deployment xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-configuration.xsd">
+   <configuration>
+
+       <!-- true to expose JBoss Messaging resources through JMX -->
+       <jmx-management-enabled>true</jmx-management-enabled>
+
+      <!-- Connectors -->
+      <connectors>
+         <connector name="netty">
+            <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+            <param key="jbm.remoting.netty.port" value="5445" type="Integer"/>
+         </connector>
+      </connectors>
+      
+      <!-- Acceptors -->
+      <acceptors>
+         <acceptor name="netty">
+            <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+            <param key="jbm.remoting.netty.port" value="5445" type="Integer"/>
+         </acceptor>
+      </acceptors>
+
+      <!-- Other config -->
+
+      <journal-min-files>2</journal-min-files>
+
+   </configuration>
+
+</deployment>

Added: trunk/examples/jms/client-kickoff/server0/jbm-jms.xml
===================================================================
--- trunk/examples/jms/client-kickoff/server0/jbm-jms.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/jbm-jms.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,16 @@
+<deployment xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+   <!--the connection factory used by the example-->
+   <connection-factory name="ConnectionFactory">
+      <connector-ref connector-name="netty"/>
+      <entries>
+         <entry name="ConnectionFactory"/>
+         <entry name="XAConnectionFactory"/>
+         <entry name="java:/ConnectionFactory"/>
+         <entry name="java:/XAConnectionFactory"/>
+      </entries>
+   </connection-factory>
+   
+   <!-- the example does not use any queue -->
+</deployment>
\ No newline at end of file

Added: trunk/examples/jms/client-kickoff/server0/jbm-queues.xml
===================================================================
--- trunk/examples/jms/client-kickoff/server0/jbm-queues.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/jbm-queues.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,7 @@
+<settings xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-queues.xsd ">
+   
+   <!-- the example does not require any queue settings -->
+   
+</settings>

Added: trunk/examples/jms/client-kickoff/server0/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/client-kickoff/server0/jbm-standalone-beans.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/jbm-standalone-beans.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
+
+   <!-- JNDI server. Disable this if you don't want JNDI -->
+   <bean name="JNDIServer" class="org.jnp.server.Main">
+      <property name="namingInfo">
+         <inject bean="Naming"/>
+      </property>
+      <property name="port">1099</property>
+      <property name="bindAddress">localhost</property>
+      <property name="rmiPort">1098</property>
+      <property name="rmiBindAddress">localhost</property>
+   </bean>
+   
+   <!-- MBean server -->
+   <bean name="MBeanServer" class="javax.management.MBeanServer">
+      <constructor factoryClass="java.lang.management.ManagementFactory"
+                   factoryMethod="getPlatformMBeanServer"/>
+   </bean> 
+
+   <!-- The core configuration -->
+   <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+   <!-- The security manager -->
+   <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+      <start ignored="true"/>
+      <stop ignored="true"/>
+   </bean>
+
+   <!-- The core server -->
+   <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl"> 
+      <constructor>
+         <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+         <parameter>
+            <inject bean="MBeanServer"/>
+         </parameter>
+         <parameter>
+            <inject bean="JBMSecurityManager"/>
+         </parameter>        
+      </constructor>         
+   </bean>
+   
+   <!-- The JMS server -->
+   <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+      <constructor>         
+         <parameter>
+            <inject bean="MessagingServer"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+</deployment>

Added: trunk/examples/jms/client-kickoff/server0/jbm-users.xml
===================================================================
--- trunk/examples/jms/client-kickoff/server0/jbm-users.xml	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/server0/jbm-users.xml	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-users.xsd ">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</deployment>
\ No newline at end of file

Added: trunk/examples/jms/client-kickoff/src/org/jboss/jms/example/ClientKickoffExample.java
===================================================================
--- trunk/examples/jms/client-kickoff/src/org/jboss/jms/example/ClientKickoffExample.java	                        (rev 0)
+++ trunk/examples/jms/client-kickoff/src/org/jboss/jms/example/ClientKickoffExample.java	2009-04-23 09:47:30 UTC (rev 6530)
@@ -0,0 +1,136 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+   * 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.jms.example;
+
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.naming.InitialContext;
+
+import org.jboss.messaging.core.management.MessagingServerControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+
+/**
+ * An example that shows how to kick off a client connected to JBoss Messagingby using JMX.
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ClientKickoffExample extends JMSExample
+{
+   private String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi";
+
+   public static void main(String[] args)
+   {
+      String[] serverJMXArgs = new String[] { "-Dcom.sun.management.jmxremote",
+                                             "-Dcom.sun.management.jmxremote.port=3000",
+                                             "-Dcom.sun.management.jmxremote.ssl=false",
+                                             "-Dcom.sun.management.jmxremote.authenticate=false" };
+      new ClientKickoffExample().run(serverJMXArgs, args);
+   }
+
+   public boolean runExample() throws Exception
+   {
+      QueueConnection connection = null;
+      InitialContext initialContext = null;
+      try
+      {
+         // Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = getContext(0);
+
+         // Step 2. Perform a lookup on the Connection Factory
+         QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory");
+
+         // Step 3.Create a JMS Connection
+         connection = cf.createQueueConnection();
+
+         // Step 4. Set an exception listener on the connection to be notified after a problem occurred
+         final AtomicReference<JMSException> exception = new AtomicReference<JMSException>();
+         connection.setExceptionListener(new ExceptionListener()
+         {
+            public void onException(JMSException e)
+            {
+               exception.set(e);
+            }
+         });
+
+         // Step 5. We start the connection
+         connection.start();
+
+         // Step 6. Create a MessagingServerControlMBean proxy to manage the server
+         ObjectName on = ObjectNames.getMessagingServerObjectName();
+         JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, String>());
+         MBeanServerConnection mbsc = connector.getMBeanServerConnection();
+         MessagingServerControlMBean serverControl = (MessagingServerControlMBean)MBeanServerInvocationHandler.newProxyInstance(mbsc,
+                                                                                                                                on,
+                                                                                                                                MessagingServerControlMBean.class,
+                                                                                                                                false);
+
+         // Step 7. List the remote address connected to the server
+         System.out.println("List of remote addresses connected to the server:");
+         System.out.println("----------------------------------");
+         String[] remoteAddresses = serverControl.listRemoteAddresses();
+         for (String remoteAddress : remoteAddresses)
+         {
+            System.out.println(remoteAddress);
+         }
+         System.out.println("----------------------------------");
+
+         // Step 8. Close the connections for the 1st remote address and kickoff the client
+         serverControl.closeConnectionsForAddress(remoteAddresses[0]);
+
+         // Sleep a little bit so that the stack trace from the server won't be
+         // mingled with the JMSException received on the ExceptionListener
+         Thread.sleep(1000);
+
+         // Step 9. Display the exception received by the connection's ExceptionListener
+         System.err.println("\nException received from the server:");
+         System.err.println("----------------------------------");
+         exception.get().printStackTrace();
+         System.err.println("----------------------------------");
+
+         return true;
+      }
+      finally
+      {
+         // Step 10. Be sure to close the resources!
+         if (initialContext != null)
+         {
+            initialContext.close();
+         }
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
+}

Modified: trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java
===================================================================
--- trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java	2009-04-23 09:43:18 UTC (rev 6529)
+++ trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java	2009-04-23 09:47:30 UTC (rev 6530)
@@ -213,11 +213,11 @@
    {
       if (server.getInputStream() != null)
       {
-         server.getInputStream().close();
+         //server.getInputStream().close();
       }
       if (server.getErrorStream() != null)
       {
-         server.getErrorStream().close();
+         //server.getErrorStream().close();
       }
       server.destroy();
    }




More information about the jboss-cvs-commits mailing list