Author: jmesnil
Date: 2009-11-04 11:55:22 -0500 (Wed, 04 Nov 2009)
New Revision: 8211
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
make sure sessions are properly closed
* in sendInRange(), close the session in a finally block as some cluster tests
will fail to send the message (e.g. ClusteredGroupingTest)
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-04
16:45:51 UTC (rev 8210)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-04
16:55:22 UTC (rev 8211)
@@ -417,23 +417,27 @@
ClientSession session = sf.createSession(false, true, true);
- ClientProducer producer = session.createProducer(address);
-
- for (int i = msgStart; i < msgEnd; i++)
+ try
{
- ClientMessage message = session.createClientMessage(durable);
+ ClientProducer producer = session.createProducer(address);
- if (filterVal != null)
+ for (int i = msgStart; i < msgEnd; i++)
{
- message.putStringProperty(FILTER_PROP, new SimpleString(filterVal));
- }
+ ClientMessage message = session.createClientMessage(durable);
- message.putIntProperty(COUNT_PROP, i);
+ if (filterVal != null)
+ {
+ message.putStringProperty(FILTER_PROP, new SimpleString(filterVal));
+ }
- producer.send(message);
+ message.putIntProperty(COUNT_PROP, i);
+
+ producer.send(message);
+ }
+ } finally
+ {
+ session.close();
}
-
- session.close();
}
protected void sendWithProperty(int node,
@@ -463,18 +467,23 @@
ClientSession session = sf.createSession(false, true, true);
- ClientProducer producer = session.createProducer(address);
-
- for (int i = msgStart; i < msgEnd; i++)
+ try
{
- ClientMessage message = session.createClientMessage(durable);
+ ClientProducer producer = session.createProducer(address);
- message.putStringProperty(key, val);
- message.putIntProperty(COUNT_PROP, i);
- producer.send(message);
+ for (int i = msgStart; i < msgEnd; i++)
+ {
+ ClientMessage message = session.createClientMessage(durable);
+
+ message.putStringProperty(key, val);
+ message.putIntProperty(COUNT_PROP, i);
+ producer.send(message);
+ }
}
-
- session.close();
+ finally
+ {
+ session.close();
+ }
}
protected void setUpGroupHandler(GroupingHandlerConfiguration.TYPE type, int node)