[jboss-cvs] JBoss Messaging SVN: r6338 - in trunk/examples/jms: clustered-queue/src/org/jboss/jms/example and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 7 07:44:06 EDT 2009
Author: timfox
Date: 2009-04-07 07:44:06 -0400 (Tue, 07 Apr 2009)
New Revision: 6338
Modified:
trunk/examples/jms/clustered-queue/readme.html
trunk/examples/jms/clustered-queue/src/org/jboss/jms/example/ClusteredQueueExample.java
trunk/examples/jms/clustered-topic/readme.html
trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java
trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java
Log:
updates to clustered queue and topic examples
Modified: trunk/examples/jms/clustered-queue/readme.html
===================================================================
--- trunk/examples/jms/clustered-queue/readme.html 2009-04-07 11:32:54 UTC (rev 6337)
+++ trunk/examples/jms/clustered-queue/readme.html 2009-04-07 11:44:06 UTC (rev 6338)
@@ -1,19 +1,18 @@
<html>
<head>
- <title>JBoss Messaging JMS Load Balanced Queue Example without JNDI</title>
+ <title>JBoss Messaging JMS Load Balanced Queue Example/title>
<link rel="stylesheet" type="text/css" href="../common/common.css">
</head>
<body>
- <h1>JBoss Messaging JMS Load Balanced Queue Example without JNDI</h1>
+ <h1>JBoss Messaging JMS Load Balanced Queue Example</h1>
<br>
<p>This example demonstrates a JMS queue deployed on two different nodes. The two nodes are configured to form a cluster.</p>
<p>We then create a consumer on the queue on each node, and we create a producer on only one of the nodes.</p>
<p>We then send some messages via the producer, and we verify that <b>both</b> consumers receive the sent messages
in a round-robin fashion.</p>
<p>In other words, JBoss Messaging <b>load balances</b> the sent messages across all consumers on the cluster</p>
- <p>This example does not use JNDI to lookup the JMS Queue and ConnectionFactory objects, instead it instantiates them
- directly. Another example is available which demonstrates them being looked up from JNDI.</p>
- <br>
+ <p>This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use
+ JNDI, these could be instantiated directly.</p>
<p>Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes
and to load balance the messages between the nodes.</p>
<pre>
@@ -34,46 +33,31 @@
<p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
<br>
<ol>
- <li>We directly instantiate a JMS Queue object. (Alternatively you could look up from JNDI - this is covered in a separate example)</li>
+ <li> Get an initial context for looking up JNDI from server 0.</li>
<pre>
<code>
- Queue queue = new JBossQueue("exampleQueue");
+ ic0 = getContext(0);
</code>
</pre>
- <li>We create some objects with the connection details of server 0 so we can connect to that server.
- JBoss Messaging provides a fully pluggable transport system. In this case we want to use Netty, so we need
- to tell the system we want to use Netty and provide the parameters for connection e.g. port</li>
+ <li>Look-up the JMS Queue object from JNDI</li>
<pre>
- <code>
- Map<String, Object> params0 = new HashMap<String, Object>();
- params0.put(TransportConstants.PORT_PROP_NAME, 5445);
- TransportConfiguration tc0 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params0);
- </code>
+ <code>Queue queue = (Queue)ic0.lookup("/queue/exampleQueue");</code>
</pre>
- <li>We directly instantiate a JMS ConnectionFactory with those connection details. This connection factory will
- create connections to server 0</li>
+ <li>Look-up a JMS Connection Factory object from JNDI on server 0</li>
<pre>
- <code>ConnectionFactory cf0 = new JBossConnectionFactory(tc0);</code>
+ <code>ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");</code>
</pre>
- <li>We create some objects with the connection details of server 1 so we can connect to that server.</li>
+ <li>Get an initial context for looking up JNDI from server 1.</li>
<pre>
- <code>
- Map<String, Object> params1 = new HashMap<String, Object>();
- params1.put(TransportConstants.PORT_PROP_NAME, 5446);
- TransportConfiguration tc1 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params1);
- </code>
+ <code>ic1 = getContext(1);</code>
</pre>
- <li>We directly instantiate a JMS ConnectionFactory with those connection details. This connection factory will
- create connections to server 1</li>
+ <li>Look-up a JMS Connection Factory object from JNDI on server 1</li>
<pre>
- <code>
- ConnectionFactory cf1 = new JBossConnectionFactory(tc1);
+ <code>ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
</code>
</pre>
@@ -150,7 +134,8 @@
JBoss Messaging has <b>load balanced</b> the messages between the available consumers on the different nodes.
JBoss Messaging can be configured to always load balance messages to all nodes, or to only balance messages
to nodes which have consumers with no or matching selectors. See the user manual for more details.</li>
-
+ JMS Queues implement point-to-point message where each message is only ever consumed by a
+ maximum of one consumer.
<pre>
<code>
for (int i = 0; i < numMessages; i += 2)
Modified: trunk/examples/jms/clustered-queue/src/org/jboss/jms/example/ClusteredQueueExample.java
===================================================================
--- trunk/examples/jms/clustered-queue/src/org/jboss/jms/example/ClusteredQueueExample.java 2009-04-07 11:32:54 UTC (rev 6337)
+++ trunk/examples/jms/clustered-queue/src/org/jboss/jms/example/ClusteredQueueExample.java 2009-04-07 11:44:06 UTC (rev 6338)
@@ -21,9 +21,6 @@
*/
package org.jboss.jms.example;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -31,12 +28,8 @@
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
+import javax.naming.InitialContext;
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.integration.transports.netty.TransportConstants;
-import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-
/**
* A simple example that demonstrates server side load-balancing of messages between the queue instances on different
* nodes of the cluster.
@@ -55,74 +48,73 @@
Connection connection0 = null;
Connection connection1 = null;
+
+ InitialContext ic0 = null;
+
+ InitialContext ic1 = null;
+
try
{
- //Step 1. We directly instantiate a JMS Queue object. (Alternatively you could look up from JNDI)
- Queue queue = new JBossQueue("exampleQueue");
+ // Step 1. Get an initial context for looking up JNDI from server 0
+ ic0 = getContext(0);
- //Step 2. We create some objects with the connection details of server 0
- Map<String, Object> params0 = new HashMap<String, Object>();
- params0.put(TransportConstants.PORT_PROP_NAME, 5445);
- TransportConfiguration tc0 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params0);
-
- //Step 3. We directly instantiate a JMS ConnectionFactory with those connection details. This connection factory will
- //create connections to server 0
- ConnectionFactory cf0 = new JBossConnectionFactory(tc0);
+ // Step 2. Look-up the JMS Queue object from JNDI
+ Queue queue = (Queue)ic0.lookup("/queue/exampleQueue");
- //Step 4. We create some objects with the connection details of server 1
- Map<String, Object> params1 = new HashMap<String, Object>();
- params1.put(TransportConstants.PORT_PROP_NAME, 5446);
- TransportConfiguration tc1 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params1);
-
- //Step 5. We directly instantiate a JMS ConnectionFactory with those connection details. This connection factory will
- //create connections to server 1
- ConnectionFactory cf1 = new JBossConnectionFactory(tc1);
+ // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
+ ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
- //Step 6. We create a JMS Connection connection0 which is a connection to server 0
+ // Step 4. Get an initial context for looking up JNDI from server 1
+ ic1 = getContext(1);
+
+ // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
+ ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
+
+ // Step 6. We create a JMS Connection connection0 which is a connection to server 0
connection0 = cf0.createConnection();
- //Step 7. We create a JMS Connection connection1 which is a connection to server 1
+ // Step 7. We create a JMS Connection connection1 which is a connection to server 1
connection1 = cf1.createConnection();
- //Step 8. We create a JMS Session on server 0
+ // Step 8. We create a JMS Session on server 0
Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
- //Step 9. We create a JMS Session on server 1
+ // Step 9. We create a JMS Session on server 1
Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
- //Step 10. We start the connections to ensure delivery occurs on them
+ // Step 10. We start the connections to ensure delivery occurs on them
connection0.start();
connection1.start();
- //Step 11. We create JMS MessageConsumer objects on server 0 and server 1
+ // Step 11. We create JMS MessageConsumer objects on server 0 and server 1
MessageConsumer consumer0 = session0.createConsumer(queue);
MessageConsumer consumer1 = session1.createConsumer(queue);
-
+
Thread.sleep(1000);
- //Step 12. We create a JMS MessageProducer object on server 0
+ // Step 12. We create a JMS MessageProducer object on server 0
MessageProducer producer = session0.createProducer(queue);
- //Step 13. We send some messages to server 0
-
+ // Step 13. We send some messages to server 0
+
final int numMessages = 10;
for (int i = 0; i < numMessages; i++)
{
TextMessage message = session0.createTextMessage("This is text message " + i);
-
+
producer.send(message);
System.out.println("Sent message: " + message.getText());
}
-
- //Step 14. We now consume those messages on *both* server 0 and server 1.
- //We note the messages have been distributed between servers in a round robin fashion
+ // Step 14. We now consume those messages on *both* server 0 and server 1.
+ // We note the messages have been distributed between servers in a round robin fashion
+ // JMS Queues implement point-to-point message where each message is only ever consumed by a
+ // maximum of one consumer
+
for (int i = 0; i < numMessages; i += 2)
{
TextMessage message0 = (TextMessage)consumer0.receive(5000);
@@ -138,17 +130,27 @@
}
finally
{
- // Step 15. Be sure to close our JMS resources!
+ // Step 15. Be sure to close our resources!
+
if (connection0 != null)
{
connection0.close();
}
-
+
if (connection1 != null)
{
connection1.close();
}
+ if (ic0 != null)
+ {
+ ic0.close();
+ }
+
+ if (ic1 != null)
+ {
+ ic1.close();
+ }
}
}
Modified: trunk/examples/jms/clustered-topic/readme.html
===================================================================
--- trunk/examples/jms/clustered-topic/readme.html 2009-04-07 11:32:54 UTC (rev 6337)
+++ trunk/examples/jms/clustered-topic/readme.html 2009-04-07 11:44:06 UTC (rev 6338)
@@ -1,92 +1,173 @@
<html>
<head>
- <title>JBoss Messaging JMS Queue Example</title>
+ <title>JBoss Messaging JMS Clustered Topic Example</title>
<link rel="stylesheet" type="text/css" href="../common/common.css">
</head>
<body>
- <h1>JMS Queue Example</h1>
+ <h1>JBoss Messaging JMS Clustered Topic Example</h1>
<br>
- <p>This example shows you how to send and receive a message to a JMS Queue with JBoss Messaging.</p>
- <p>Queues are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p>
- <p>A Queue is used to send messages point to point, from a producer to a consumer. The queue guarantees message ordering between these 2 points.</p>
- <br>
+ <p>This example demonstrates a JMS Topic deployed on two different nodes. The two nodes are configured to form a cluster.</p>
+ <p>We then create a subscriber on the topic on each node, and we create a producer on only one of the nodes.</p>
+ <p>We then send some messages via the producer, and we verify that <b>both</b> subscribers receive all the
+ sent messages.</p>
+ <p>A JMS Topic is an example of <b>publish-subscribe</b> messaging where all subscribers receive all the
+ messages sent to the topic (assuming they have no message selectors).</p>
+ <p>This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use
+ JNDI, these could be instantiated directly.
+ <p>Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes
+ and to load balance the messages between the nodes.</p>
+ <pre>
+ <code>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>true</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </code>
+ </pre>
+ <p>For more information on JBoss Messaging load balancing, and clustering in general, please see the clustering
+ section of the user manual.</p>
<h2>Example step-by-step</h2>
<p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
<br>
<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 it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
+ <li> Get an initial context for looking up JNDI from server 0.</li>
<pre>
- <code>InitialContext initialContext = getContext();</code>
+ <code>
+ ic0 = getContext(0);
+ </code>
</pre>
- <li>We look-up the JMS queue object from JNDI</li>
+ <li>Look-up the JMS Topic object from JNDI</li>
<pre>
- <code>Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");</code>
+ <code>Topic topic = (Topic)ic0.lookup("/topic/exampleTopic");</code>
</pre>
- <li>We look-up the JMS connection factory object from JNDI</li>
+ <li>Look-up a JMS Connection Factory object from JNDI on server 0</li>
<pre>
- <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
+ <code>ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");</code>
</pre>
- <li>We create a JMS connection</li>
+ <li>Get an initial context for looking up JNDI from server 1.</li>
<pre>
- <code>connection = cf.createConnection();</code>
+ <code>ic1 = getContext(1);</code>
</pre>
- <li>We create a JMS session. The session is created as non transacted and will auto acknowledge messages.</li>
+ <li>Look-up a JMS Connection Factory object from JNDI on server 1</li>
<pre>
- <code>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
+ <code>ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
+ </code>
</pre>
- <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
+ <li>We create a JMS Connection connection0 which is a connection to server 0</li>
<pre>
- <code>MessageProducer messageProducer = session.createProducer(topic);</code>
- </pre>
+ <code>
+ connection0 = cf0.createConnection();
+ </code>
+ </pre>
+
+ <li>We create a JMS Connection connection1 which is a connection to server 1</li>
+ <pre>
+ <code>
+ connection1 = cf1.createConnection();
+ </code>
+ </pre>
- <li>We create a JMS text message that we are going to send.</li>
+ <li>We create a JMS Session on server 0</li>
<pre>
- <code>TextMessage message = session.createTextMessage("This is a text message");</code>
+ <code>
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ </code>
</pre>
+
+ <li>We create a JMS Session on server 1</li>
+ <pre>
+ <code>
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ </code>
+ </pre>
- <li>We send message to the queue</li>
+ <li>We start the connections to ensure delivery occurs on them</li>
<pre>
- <code>messageProducer.send(message);</code>
+ <code>
+ connection0.start();
+
+ connection1.start();
+ </code>
</pre>
- <li>We create a JMS Message Consumer to receive the message.</li>
- <pre>
- <code>MessageConsumer messageConsumer = session.createConsumer(queue);</code>
+ <li>We create JMS MessageConsumer (Topic subscriber) objects on server 0 and server 1</li>
+ <pre>
+ <code>
+ MessageConsumer consumer0 = session0.createConsumer(topic);
+
+ MessageConsumer consumer1 = session1.createConsumer(topic);
+ </code>
</pre>
- <li>We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started</li>
+ <li>We create a JMS MessageProducer object on server 0.</li>
<pre>
- <code>connection.start();</code>
+ <code>
+ MessageProducer producer = session0.createProducer(topic);</code>
</pre>
- <li>The message arrives at the consumer. In this case we use a timeout of 5000 milliseconds but we could use a blocking 'receive()'</li>
+ <li>We send some messages to server 0.</li>
<pre>
- <code>TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);</code>
+ <code>
+ final int numMessages = 10;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message = session0.createTextMessage("This is text message " + i);
+
+ producer.send(message);
+
+ System.out.println("Sent message: " + message.getText());
+ }
+ </code>
</pre>
+
+ <li>
+ We now consume those messages on *both* server 0 and server 1.
+ We note that all messages have been consumed by *both* consumers.
+ JMS Topics implement *publish-subscribe* messaging where all consumers get a copy of all messages.
+ <pre>
+ <code>
+ for (int i = 0; i < numMessages; i ++)
+ {
+ TextMessage message0 = (TextMessage)consumer0.receive(5000);
+
+ System.out.println("Got message: " + message0.getText() + " from node 0");
+
+ TextMessage message1 = (TextMessage)consumer1.receive(5000);
+
+ System.out.println("Got message: " + message1.getText() + " from node 1");
+ }
+ </code>
+ </pre>
- <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>
+ <li>And finally (no pun intended), <b>always</b> remember to close your JMS 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>
+ <code>
+ finally
+ {
+ if (connection0 != null)
+ {
+ connection0.close();
+ }
+
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+ }
+ </code>
</pre>
-
-
</ol>
</body>
</html>
\ No newline at end of file
Modified: trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java
===================================================================
--- trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java 2009-04-07 11:32:54 UTC (rev 6337)
+++ trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java 2009-04-07 11:44:06 UTC (rev 6338)
@@ -21,9 +21,6 @@
*/
package org.jboss.jms.example;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -31,14 +28,11 @@
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
+import javax.naming.InitialContext;
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.integration.transports.netty.TransportConstants;
-import org.jboss.messaging.jms.JBossTopic;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-
/**
- * A simple JMS Topic example
+ * A simple example that shows a JMS Topic clustered across two nodes of a cluster.
+ * Messages are sent on one node and received by consumers on both nodes.
*
*/
public class ClusteredTopicExample extends JMSExample
@@ -53,53 +47,72 @@
Connection connection0 = null;
Connection connection1 = null;
+
+ InitialContext ic0 = null;
+
+ InitialContext ic1 = null;
+
try
{
- Topic topic = new JBossTopic("exampleTopic");
+ // Step 1. Get an initial context for looking up JNDI from server 0
+ ic0 = getContext(0);
- Map<String, Object> params0 = new HashMap<String, Object>();
- params0.put(TransportConstants.PORT_PROP_NAME, 5445);
- TransportConfiguration tc0 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params0);
- ConnectionFactory cf0 = new JBossConnectionFactory(tc0);
+ // Step 2. Look-up the JMS Topic object from JNDI
+ Topic topic = (Topic)ic0.lookup("/topic/exampleTopic");
- Map<String, Object> params1 = new HashMap<String, Object>();
- params1.put(TransportConstants.PORT_PROP_NAME, 5446);
- TransportConfiguration tc1 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
- params1);
- ConnectionFactory cf1 = new JBossConnectionFactory(tc1);
+ // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
+ ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
+ // Step 4. Get an initial context for looking up JNDI from server 1
+ ic1 = getContext(1);
+
+ // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
+ ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
+
+ // Step 6. We create a JMS Connection connection0 which is a connection to server 0
connection0 = cf0.createConnection();
+ // Step 7. We create a JMS Connection connection1 which is a connection to server 1
connection1 = cf1.createConnection();
+ // Step 8. We create a JMS Session on server 0
Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ // Step 9. We create a JMS Session on server 1
Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ // Step 10. We start the connections to ensure delivery occurs on them
connection0.start();
connection1.start();
+ // Step 11. We create JMS MessageConsumer objects on server 0 and server 1
MessageConsumer consumer0 = session0.createConsumer(topic);
MessageConsumer consumer1 = session1.createConsumer(topic);
-
+
Thread.sleep(1000);
+ // Step 12. We create a JMS MessageProducer object on server 0
MessageProducer producer = session0.createProducer(topic);
+ // Step 13. We send some messages to server 0
+
final int numMessages = 10;
for (int i = 0; i < numMessages; i++)
{
TextMessage message = session0.createTextMessage("This is text message " + i);
-
+
producer.send(message);
System.out.println("Sent message: " + message.getText());
}
+ // Step 14. We now consume those messages on *both* server 0 and server 1.
+ // We note that all messages have been consumed by *both* consumers.
+ // JMS Topics implement *publish-subscribe* messaging where all consumers get a copy of all messages
+
for (int i = 0; i < numMessages; i++)
{
TextMessage message0 = (TextMessage)consumer0.receive(5000);
@@ -115,17 +128,26 @@
}
finally
{
- // Step 12. Be sure to close our JMS resources!
+ // Step 15. Be sure to close our JMS resources!
if (connection0 != null)
{
connection0.close();
}
-
+
if (connection1 != null)
{
connection1.close();
}
+
+ if (ic0 != null)
+ {
+ ic0.close();
+ }
+ if (ic1 != null)
+ {
+ ic1.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-07 11:32:54 UTC (rev 6337)
+++ trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java 2009-04-07 11:44:06 UTC (rev 6338)
@@ -118,7 +118,7 @@
}
return new InitialContext(props);
}
-
+
private void startServer(String[] args, boolean logServerOutput) throws Throwable
{
servers = new Process[args.length];
More information about the jboss-cvs-commits
mailing list