JBoss hornetq SVN: r9131 - trunk/tests/src/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-04-16 00:13:49 -0400 (Fri, 16 Apr 2010)
New Revision: 9131
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
Log:
Fixing test as it was swallowing failures
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-04-15 16:36:54 UTC (rev 9130)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-04-16 04:13:49 UTC (rev 9131)
@@ -64,7 +64,7 @@
}
}
- public void testNonTransactional() throws Exception
+ public void testNonTransactional() throws Throwable
{
runTest(new TestRunner()
{
@@ -74,15 +74,16 @@
{
doTestNonTransactional(this);
}
- catch (Exception e)
+ catch (Throwable e)
{
AsynchronousFailoverTest.log.error("Test failed", e);
+ addException(e);
}
}
});
}
- public void testTransactional() throws Exception
+ public void testTransactional() throws Throwable
{
runTest(new TestRunner()
{
@@ -92,9 +93,10 @@
{
doTestTransactional(this);
}
- catch (Exception e)
+ catch (Throwable e)
{
AsynchronousFailoverTest.log.error("Test failed", e);
+ addException(e);
}
}
});
@@ -104,6 +106,8 @@
{
volatile boolean failed;
+ ArrayList<Throwable> errors = new ArrayList<Throwable>();
+
boolean isFailed()
{
return failed;
@@ -118,9 +122,33 @@
{
failed = false;
}
+
+ synchronized void addException(Throwable e)
+ {
+ errors.add(e);
+ }
+
+ void checkForExceptions() throws Throwable
+ {
+ if (errors.size() > 0)
+ {
+ log.warn("Exceptions on test:");
+ for (Throwable e: errors)
+ {
+ log.warn(e.getMessage(), e);
+ }
+ // throwing the first error that happened on the Runnable
+ throw errors.get(0);
+ }
+
+
+
+ }
+
+
}
- private void runTest(final TestRunner runnable) throws Exception
+ private void runTest(final TestRunner runnable) throws Throwable
{
final int numIts = 1;
@@ -172,6 +200,8 @@
AsynchronousFailoverTest.log.info("Fail complete");
t.join();
+
+ runnable.checkForExceptions();
createSession.close();
@@ -187,6 +217,7 @@
if (i != numIts - 1)
{
tearDown();
+ runnable.checkForExceptions();
runnable.reset();
setUp();
}
@@ -211,7 +242,7 @@
session.addFailureListener(listener);
this.listener = listener;
-
+
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final int numMessages = 1000;
14 years, 5 months
JBoss hornetq SVN: r9130 - trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-04-15 12:36:54 -0400 (Thu, 15 Apr 2010)
New Revision: 9130
Modified:
trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
Log:
fixed test
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-04-15 15:12:03 UTC (rev 9129)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-04-15 16:36:54 UTC (rev 9130)
@@ -814,6 +814,8 @@
TextMessage msg1 = session.createTextMessage("msg1");
prod.send(msg1);
+
+ Thread.sleep(2);
TextMessage msg2 = session.createTextMessage("msg2");
prod.send(msg2);
14 years, 5 months
JBoss hornetq SVN: r9129 - branches/HnetQ_323_cn/docs/user-manual/zh.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-04-15 11:12:03 -0400 (Thu, 15 Apr 2010)
New Revision: 9129
Modified:
branches/HnetQ_323_cn/docs/user-manual/zh/management.xml
Log:
done with this chapter
Modified: branches/HnetQ_323_cn/docs/user-manual/zh/management.xml
===================================================================
--- branches/HnetQ_323_cn/docs/user-manual/zh/management.xml 2010-04-15 14:46:37 UTC (rev 9128)
+++ branches/HnetQ_323_cn/docs/user-manual/zh/management.xml 2010-04-15 15:12:03 UTC (rev 9129)
@@ -589,71 +589,60 @@
</section>
<section id="management.notifications">
- <title>Management Notifications</title>
- <para>HornetQ emits <emphasis>notifications</emphasis> to inform listeners of potentially
- interesting events (creation of new resources, security violation, etc.).</para>
- <para>These notifications can be received by 3 different ways:</para>
+ <title>管理通知</title>
+ <para>HornetQ可以向listener发送各种事件的<emphasis>通知</emphasis>(如资源的创建,安全破坏等)。</para>
+ <para>有三种方式接收管理通知</para>
<itemizedlist>
<listitem>
- <para>JMX notifications</para>
+ <para>JMX通知</para>
</listitem>
<listitem>
- <para>Core messages</para>
+ <para>核心消息</para>
</listitem>
<listitem>
- <para>JMS messages</para>
+ <para>JMS消息</para>
</listitem>
</itemizedlist>
<section>
- <title>JMX Notifications</title>
- <para>If JMX is enabled (see <xref linkend="management.jmx.configuration"/>), JMX
- notifications can be received by subscribing to 2 MBeans:</para>
+ <title>JMX通知</title>
+ <para>如果设置了JMX(参见<xref linkend="management.jmx.configuration"/>),就可以通过订阅以下
+ 两个MBean来获得通知:</para>
<itemizedlist>
<listitem>
- <para><literal>org.hornetq:module=Core,type=Server</literal> for notifications on
- <emphasis>Core</emphasis> resources</para>
+ <para><literal>org.hornetq:module=Core,type=Server</literal> 可以获得有关
+ <emphasis>核心</emphasis>资源的通知</para>
</listitem>
<listitem>
- <para><literal>org.hornetq:module=JMS,type=Server</literal> for notifications on
- <emphasis>JMS</emphasis> resources</para>
+ <para><literal>org.hornetq:module=JMS,type=Server</literal>可以获得有关
+ <emphasis>JMS</emphasis>资源的通知</para>
</listitem>
</itemizedlist>
</section>
<section>
- <title>Core Messages Notifications</title>
- <para>HornetQ defines a special <emphasis>management notification address</emphasis>. Core
- queues can be bound to this address so that clients will receive management
- notifications as Core messages</para>
- <para>A Core client which wants to receive management notifications must create a core
- queue bound to the management notification address. It can then receive the
- notifications from its queue.</para>
- <para>Notifications messages are regular core messages with additional properties
- corresponding to the notification (its type, when it occurred, the resources which were
- concerned, etc.).</para>
- <para>Since notifications are regular core messages, it is possible to use message
- selectors to filter out notifications and receives only a subset of all the
- notifications emitted by the server.</para>
+ <title>核心消息通知</title>
+ <para>HornetQ定义了一个特殊的<emphasis>管理通知地址</emphasis>。核心队列绑定到该地址后,客户
+ 端就可以接收以核心消息形式发送的管理信通知了。</para>
+ <para>一个核心客户端要想接收到管理通知,它必须要创建一个队列并绑定到这个管理通知地址上,然后从这个
+ 队列接收通知。</para>
+ <para>通知消息就是普通的核心消息加上相关的属性(如通知类型,事件发生时间,资源等)。</para>
+ <para>由于是标准的核心消息,使用选择器还能够过滤掉一部分通知而只接收感兴趣的通知。</para>
<section id="management.notifications.core.configuration">
- <title>Configuring The Core Management Notification Address</title>
- <para>the management notification address to receive management notifications is
- configured in <literal>hornetq-configuration.xml</literal>:</para>
+ <title>配置核心管理通知地址</title>
+ <para>用来发送管理通知的地址在文件中<literal>hornetq-configuration.xml</literal>配置:</para>
<programlisting>
<management-notification-address>hornetq.notifications</management-notification-address>
</programlisting>
- <para>By default, the address is <literal>hornetq.notifications</literal>.</para>
+ <para>默认的地址是<literal>hornetq.notifications</literal>。</para>
</section>
</section>
<section>
- <title>JMS Messages Notifications</title>
- <para>HornetQ's notifications can also be received using JMS messages.</para>
- <para>It is similar to receiving notifications using Core API but an important difference
- is that JMS requires a JMS Destination to receive the messages (preferably a
- Topic):</para>
+ <title>JMS消息通知</title>
+ <para>HornetQ还可以通过JMS消息的方式发送通知。</para>
+ <para>这种方式与核心消息通知相似,但是有一个重要的不同:JMS消息需要一个JMS的目标(通常是一个Topic):</para>
<programlisting>
Topic notificationsTopic = HornetQJMSClient.createHornetQTopic("hornetq.notifications", "hornetq.notifications");
</programlisting>
- <para>Once the notification topic is created, you can receive messages from it or set a
- <literal>MessageListener</literal>:</para>
+ <para>这个通知话题一旦被创建,就可以接收消息了(或者使用<literal>MessageListener</literal>):</para>
<programlisting>
Topic notificationsTopic = HornetQJMSClient.createHornetQTopic("hornetq.notifications", "hornetq.notifications");
@@ -683,77 +672,64 @@
</programlisting>
</section>
<section>
- <title>Example</title>
- <para>See <xref linkend="examples.management-notifications"/> for an example which shows
- how to use a JMS <literal>MessageListener</literal> to receive management notifications
- from HornetQ server.</para>
+ <title>例子</title>
+ <para>参见<xref linkend="examples.management-notifications"/>。本例采用了JMS的<literal>
+ MessageListener</literal>方法从HornetQ
+ 服务器接收管理通知。</para>
</section>
</section>
<section id="management.message-counters">
- <title>Message Counters</title>
- <para>Message counters can be used to obtain information on queues <emphasis>over
- time</emphasis> as HornetQ keeps a history on queue metrics.</para>
- <para>They can be used to show <emphasis>trends</emphasis> on queues. For example, using the
- management API, it would be possible to query the number of messages in a queue at regular
- interval. However, this would not be enough to know if the queue is used: the number of
- messages can remain constant because nobody is sending or receiving messages from the queue
- or because there are as many messages sent to the queue than messages consumed from it. The
- number of messages in the queue remains the same in both cases but its use is widely
- different.</para>
- <para>Message counters gives additional information about the queues:</para>
+ <title>消息计数器</title>
+ <para>HornetQ保存着队列的历史数据,而消息计数器可以从服务器上获取这些信息。</para>
+ <para>这些信息可以显示队列的一些<emphasis>趋势</emphasis>。例如,使用管理接口你可以定期来查询一个队列
+ 的消息数量。但这个数量不足以说明这个队列是否在工作--也许这个队列既没有发送者也没有接收者;也许这个队列
+ 在不停地发送与接收,但是发送消息的速度与接收的速度相等。两咱情况下都会造成消息数在队列中不变,但实际队列
+ 的状态确完全不一样。</para>
+ <para>消息计数器可以提供队列的更多的信息:</para>
<itemizedlist>
<listitem>
<para><literal>count</literal></para>
- <para>The <emphasis>total</emphasis> number of messages added to the queue since the
- server was started</para>
+ <para>从服务器启动时加到队列中的<emphasis>总</emphasis>消息数。</para>
</listitem>
<listitem>
<para><literal>countDelta</literal></para>
- <para>the number of messages added to the queue <emphasis>since the last message counter
- update</emphasis></para>
+ <para>自<emphasis>上次消息计数器更新</emphasis>后加入到队列的消息数。</para>
</listitem>
<listitem>
<para><literal>depth</literal></para>
- <para>The <emphasis>current</emphasis> number of messages in the queue</para>
+ <para>队列<emphasis>当前</emphasis>的消息数。</para>
</listitem>
<listitem>
<para><literal>depthDelta</literal></para>
- <para>The <emphasis>overall</emphasis> number of messages added/removed from the queue
- <emphasis>since the last message counter update</emphasis>. For example, if
- <literal>depthDelta</literal> is equal to <literal>-10</literal> this means that
- overall 10 messages have been removed from the queue (e.g. 2 messages were added and
- 12 were removed)</para>
+ <para>自<emphasis>上次消息计数器更新</emphasis>后被加入/删除的消息<emphasis>总数</emphasis>。
+ 例如,如果<literal>depthDelta</literal>是<literal>-10</literal>,就意谓着有10个消息从
+ 队列中删除了(有可能是2个消息加入了但有12个消息删除了)。</para>
</listitem>
<listitem>
<para><literal>lastAddTimestamp</literal></para>
- <para>The timestamp of the last time a message was added to the queue</para>
+ <para>最后一个消息加入到队列的时间戳。</para>
</listitem>
<listitem>
<para><literal>udpateTimestamp</literal></para>
- <para>The timestamp of the last message counter update</para>
+ <para>最后一次消息计数器更新的时间戳。</para>
</listitem>
</itemizedlist>
<section id="configuring.message.counters">
- <title>Configuring Message Counters</title>
- <para>By default, message counters are disabled as it might have a small negative effect on
- memory.</para>
- <para>To enable message counters, you can set it to <literal>true</literal> in <literal
- >hornetq-configuration.xml</literal>:</para>
+ <title>配置消息计数器</title>
+ <para>默认的消息计数器是关闭的,因为它需要占用一些内存。</para>
+ <para>要打开消息计数器,编辑<literal>hornetq-configuration.xml</literal>文件将其设为<literal>true</literal>:</para>
<programlisting>
<message-counter-enabled>true</message-counter-enabled>
</programlisting>
- <para>Message counters keeps a history of the queue metrics (10 days by default) and
- samples all the queues at regular interval (10 seconds by default). If message counters
- are enabled, these values should be configured to suit your messaging use case in
- <literal>hornetq-configuration.xml</literal>:</para>
+ <para>消息计数器会保存队列的历史数据(默认是10天)。它以一定间隔(默认10秒一次)对每个队列进行扫描。
+ 如果消息计数器打开,这些参数可以在<literal>hornetq-configuration.xml</literal>文件中进行调整:</para>
<programlisting>
<!-- keep history for a week -->
<message-counter-max-day-history>7</message-counter-max-day-history>
<!-- sample the queues every minute (60000ms) -->
<message-counter-sample-period>60000</message-counter-sample-period>
</programlisting>
- <para>Message counters can be retrieved using the Management API. For example, to retrieve
- message counters on a JMS Queue using JMX:</para>
+ <para>使用管理接口可以获得消息计数器。例如要使用JMX得到一个JMS队列的消息计数器:</para>
<programlisting>
// retrieve a connection to HornetQ's MBeanServer
MBeanServerConnection mbsc = ...
@@ -771,9 +747,8 @@
</programlisting>
</section>
<section>
- <title>Example</title>
- <para>See <xref linkend="examples.message-counters"/> for an example which shows how to use
- message counters to retrieve information on a JMS <literal>Queue</literal>.</para>
+ <title>例子</title>
+ <para>参见<xref linkend="examples.message-counters"/>。这个例子使用消息计数器来获得一个JMS队列的相关数据。</para>
</section>
</section>
</chapter>
14 years, 5 months
JBoss hornetq SVN: r9128 - in trunk: src/main/org/hornetq/core/client/impl and 9 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-04-15 10:46:37 -0400 (Thu, 15 Apr 2010)
New Revision: 9128
Modified:
trunk/src/main/org/hornetq/api/core/Message.java
trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
trunk/src/main/org/hornetq/core/filter/impl/FilterParser.jj
trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
trunk/src/main/org/hornetq/jms/client/HornetQMessageProducer.java
trunk/src/main/org/hornetq/jms/client/SelectorTranslator.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/hornetq/utils/UUID.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
trunk/tests/src/org/hornetq/tests/unit/jms/client/SelectorTranslatorTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-357
Modified: trunk/src/main/org/hornetq/api/core/Message.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/Message.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/api/core/Message.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -16,7 +16,9 @@
import java.util.Map;
import java.util.Set;
+import org.hornetq.utils.UUID;
+
/**
* A Message is a routable instance that has a payload.
* <br/>
@@ -90,17 +92,17 @@
long getMessageID();
/**
- * Returns the userID - this is an optional user specified String that can be set to identify the message
+ * Returns the userID - this is an optional user specified UUID that can be set to identify the message
* and will be passed around with the message
- * @return
+ * @return the user id
*/
- SimpleString getUserID();
+ UUID getUserID();
/**
* Sets the user ID
* @param userID
*/
- void setUserID(SimpleString userID);
+ void setUserID(UUID userID);
/**
* Returns the address this message is sent to.
Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -1167,7 +1167,6 @@
{
return;
}
- //log.info("calling check flush on client");
connection.getTransportConnection().checkFlushBatchBuffer();
}
Modified: trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -187,7 +187,8 @@
{
if (FilterConstants.HORNETQ_USERID.equals(fieldName))
{
- return msg.getUserID();
+ //It's the stringified (hex) representation of a user id that can be used in a selector expression
+ return new SimpleString("ID:" + msg.getUserID());
}
else if (FilterConstants.HORNETQ_PRIORITY.equals(fieldName))
{
Modified: trunk/src/main/org/hornetq/core/filter/impl/FilterParser.jj
===================================================================
--- trunk/src/main/org/hornetq/core/filter/impl/FilterParser.jj 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/core/filter/impl/FilterParser.jj 2010-04-15 14:46:37 UTC (rev 9128)
@@ -62,7 +62,7 @@
public FilterParser()
{
- // keep the parser from feaking out, init using one of
+ // keep the parser from freaking out, init using one of
// the JavaCC generated constructor
this(new StringReader(""));
}
Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -30,6 +30,7 @@
import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.TypedProperties;
+import org.hornetq.utils.UUID;
/**
* A concrete implementation of a message
@@ -86,7 +87,7 @@
private boolean bufferUsed;
- private SimpleString userID;
+ private UUID userID;
// Constructors --------------------------------------------------
@@ -186,7 +187,8 @@
public int getHeadersAndPropertiesEncodeSize()
{
return DataConstants.SIZE_LONG + // Message ID
- SimpleString.sizeofNullableString(userID) +
+ DataConstants.SIZE_BYTE + // user id null?
+ (userID == null ? 0 : 16) +
/* address */SimpleString.sizeofNullableString(address) +
DataConstants./* Type */SIZE_BYTE +
DataConstants./* Durable */SIZE_BOOLEAN +
@@ -201,7 +203,15 @@
{
buffer.writeLong(messageID);
buffer.writeNullableSimpleString(address);
- buffer.writeNullableSimpleString(userID);
+ if (userID == null)
+ {
+ buffer.writeByte(DataConstants.NULL);
+ }
+ else
+ {
+ buffer.writeByte(DataConstants.NOT_NULL);
+ buffer.writeBytes(userID.asBytes());
+ }
buffer.writeByte(type);
buffer.writeBoolean(durable);
buffer.writeLong(expiration);
@@ -214,7 +224,16 @@
{
messageID = buffer.readLong();
address = buffer.readNullableSimpleString();
- userID = buffer.readNullableSimpleString();
+ if (buffer.readByte() == DataConstants.NOT_NULL)
+ {
+ byte[] bytes = new byte[16];
+ buffer.readBytes(bytes);
+ userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
+ }
+ else
+ {
+ userID = null;
+ }
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
@@ -245,12 +264,12 @@
return messageID;
}
- public SimpleString getUserID()
+ public UUID getUserID()
{
return userID;
}
- public void setUserID(final SimpleString userID)
+ public void setUserID(final UUID userID)
{
this.userID = userID;
}
@@ -355,7 +374,10 @@
Map<String, Object> map = new HashMap<String, Object>();
map.put("messageID", messageID);
- map.put("userID", userID);
+ if (userID != null)
+ {
+ map.put("userID", "ID:" + userID.toString());
+ }
map.put("address", address.toString());
map.put("type", type);
map.put("durable", durable);
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -343,8 +343,6 @@
localBindAddress = null;
}
- log.info("local bind address " + localBindAddress);
-
DiscoveryGroup group = new DiscoveryGroupImpl(nodeUUID.toString(),
config.getName(),
localBindAddress,
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -42,6 +42,7 @@
import org.hornetq.api.jms.HornetQJMSConstants;
import org.hornetq.core.client.impl.ClientMessageImpl;
import org.hornetq.core.logging.Logger;
+import org.hornetq.utils.UUID;
/**
* HornetQ implementation of a JMS Message.
@@ -330,9 +331,9 @@
{
if (msgID == null)
{
- SimpleString uid = message.getUserID();
+ UUID uid = message.getUserID();
- msgID = uid == null ? null : uid.toString();
+ msgID = uid == null ? null : "ID:" + uid.toString();
}
return msgID;
}
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMessageProducer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMessageProducer.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMessageProducer.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -405,23 +405,11 @@
if (!disableMessageID)
{
- // Generate an id
+ // Generate a JMS id
UUID uid = UUIDGenerator.getInstance().generateUUID();
- byte[] bytes = uid.asBytes();
-
- byte[] id = new byte[6 + 16];
-
- id[0] = (byte)'I';
- id[2] = (byte)'D';
- id[4] = (byte)':';
-
- System.arraycopy(bytes, 0, id, 6, 16);
-
- SimpleString ssid = new SimpleString(id);
-
- msg.getCoreMessage().setUserID(ssid);
+ msg.getCoreMessage().setUserID(uid);
msg.resetMessageID(null);
}
Modified: trunk/src/main/org/hornetq/jms/client/SelectorTranslator.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/SelectorTranslator.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/jms/client/SelectorTranslator.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -49,6 +49,7 @@
filterString = SelectorTranslator.parse(filterString, "'NON_PERSISTENT'", "'NON_DURABLE'");
filterString = SelectorTranslator.parse(filterString, "JMSPriority", "HQPriority");
filterString = SelectorTranslator.parse(filterString, "JMSTimestamp", "HQTimestamp");
+ filterString = SelectorTranslator.parse(filterString, "JMSMessageID", "HQUserID");
return filterString;
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -366,7 +366,6 @@
if (discoveryGroupName != null)
{
- log.info("discovery group name is " + discoveryGroupName);
cfConfig = new ConnectionFactoryConfigurationImpl(name, strbindings);
cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
cfConfig.setDiscoveryGroupName(discoveryGroupName);
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -801,8 +801,6 @@
final String groupId,
final String... jndiBindings) throws Exception
{
- log.info("calling create cf " + discoveryRefreshTimeout + " lba " + localBindAddress);
-
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
Modified: trunk/src/main/org/hornetq/utils/UUID.java
===================================================================
--- trunk/src/main/org/hornetq/utils/UUID.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/src/main/org/hornetq/utils/UUID.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -85,7 +85,7 @@
*/
private static boolean sDescCaching = true;
- private final byte[] mId = new byte[16];
+ private final byte[] mId;
// Both string presentation and hash value may be cached...
private transient String mDesc = null;
@@ -93,8 +93,8 @@
private transient int mHashCode = 0;
/**
- * Protected constructor used by UUIDGenerator
*
+ *
* @param type
* UUID type
* @param data
@@ -102,10 +102,7 @@
*/
public UUID(final int type, final byte[] data)
{
- for (int i = 0; i < 16; ++i)
- {
- mId[i] = data[i];
- }
+ mId = data;
// Type is multiplexed with time_hi:
mId[UUID.INDEX_TYPE] &= (byte)0x0F;
mId[UUID.INDEX_TYPE] |= (byte)(type << 4);
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -712,7 +712,226 @@
}
}
}
+
+ public void testJMSMessageIDOnSelector() throws Exception
+ {
+ Connection conn = null;
+ try
+ {
+ conn = getConnectionFactory().createConnection();
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(HornetQServerTestCase.queue1);
+
+ TextMessage msg1 = session.createTextMessage("msg1");
+ prod.send(msg1);
+
+ TextMessage msg2 = session.createTextMessage("msg2");
+ prod.send(msg2);
+
+ String selector = "JMSMessageID = '" + msg2.getJMSMessageID() + "'";
+
+ MessageConsumer cons = session.createConsumer(HornetQServerTestCase.queue1, selector);
+
+ conn.start();
+
+ TextMessage rec = (TextMessage)cons.receive(10000);
+
+ assertNotNull(rec);
+
+ assertEquals("msg2", rec.getText());
+
+ assertNull(cons.receiveNoWait());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testJMSPriorityOnSelector() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnectionFactory().createConnection();
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(HornetQServerTestCase.queue1);
+
+ TextMessage msg1 = session.createTextMessage("msg1");
+ prod.send(msg1, DeliveryMode.NON_PERSISTENT, 8, 0);
+
+ TextMessage msg2 = session.createTextMessage("msg2");
+ prod.send(msg2, DeliveryMode.NON_PERSISTENT, 2, 0);
+
+ String selector = "JMSPriority = 2";
+
+ MessageConsumer cons = session.createConsumer(HornetQServerTestCase.queue1, selector);
+
+ conn.start();
+
+ TextMessage rec = (TextMessage)cons.receive(10000);
+
+ assertNotNull(rec);
+
+ assertEquals("msg2", rec.getText());
+
+ assertNull(cons.receiveNoWait());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testJMSTimestampOnSelector() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnectionFactory().createConnection();
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(HornetQServerTestCase.queue1);
+
+ TextMessage msg1 = session.createTextMessage("msg1");
+ prod.send(msg1);
+
+ TextMessage msg2 = session.createTextMessage("msg2");
+ prod.send(msg2);
+
+ String selector = "JMSTimestamp = " + msg2.getJMSTimestamp();
+
+ MessageConsumer cons = session.createConsumer(HornetQServerTestCase.queue1, selector);
+
+ conn.start();
+
+ TextMessage rec = (TextMessage)cons.receive(10000);
+
+ assertNotNull(rec);
+
+ assertEquals("msg2", rec.getText());
+
+ assertNull(cons.receiveNoWait());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testJMSTypeOnSelector() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnectionFactory().createConnection();
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(HornetQServerTestCase.queue1);
+
+ TextMessage msg1 = session.createTextMessage("msg1");
+ msg1.setJMSType("type1");
+ prod.send(msg1);
+
+ TextMessage msg2 = session.createTextMessage("msg2");
+ msg2.setJMSType("type2");
+ prod.send(msg2);
+
+ String selector = "JMSType = 'type2'";
+
+ MessageConsumer cons = session.createConsumer(HornetQServerTestCase.queue1, selector);
+
+ conn.start();
+
+ TextMessage rec = (TextMessage)cons.receive(10000);
+
+ assertNotNull(rec);
+
+ assertEquals("msg2", rec.getText());
+
+ assertNull(cons.receiveNoWait());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testJMSCorrelationIDOnSelector() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnectionFactory().createConnection();
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(HornetQServerTestCase.queue1);
+
+ TextMessage msg1 = session.createTextMessage("msg1");
+ msg1.setJMSCorrelationID("cid1");
+ prod.send(msg1);
+
+ TextMessage msg2 = session.createTextMessage("msg2");
+ msg2.setJMSCorrelationID("cid2");
+ prod.send(msg2);
+
+ String selector = "JMSCorrelationID = 'cid2'";
+
+ MessageConsumer cons = session.createConsumer(HornetQServerTestCase.queue1, selector);
+
+ conn.start();
+
+ TextMessage rec = (TextMessage)cons.receive(10000);
+
+ assertNotNull(rec);
+
+ assertEquals("msg2", rec.getText());
+
+ assertNull(cons.receiveNoWait());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -41,6 +41,7 @@
import org.hornetq.core.transaction.TransactionOperation;
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.TypedProperties;
+import org.hornetq.utils.UUID;
/**
* A BindingImplTest
@@ -886,13 +887,13 @@
}
- public SimpleString getUserID()
+ public UUID getUserID()
{
// TODO Auto-generated method stub
return null;
}
- public void setUserID(SimpleString userID)
+ public void setUserID(UUID userID)
{
// TODO Auto-generated method stub
Modified: trunk/tests/src/org/hornetq/tests/unit/jms/client/SelectorTranslatorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/jms/client/SelectorTranslatorTest.java 2010-04-15 14:41:40 UTC (rev 9127)
+++ trunk/tests/src/org/hornetq/tests/unit/jms/client/SelectorTranslatorTest.java 2010-04-15 14:46:37 UTC (rev 9128)
@@ -97,23 +97,23 @@
{
String selector = "JMSMessageID='ID:HQ-12435678";
- Assert.assertEquals(selector, SelectorTranslator.convertToHornetQFilterString(selector));
+ Assert.assertEquals("HQUserID='ID:HQ-12435678", SelectorTranslator.convertToHornetQFilterString(selector));
selector = " JMSMessageID='ID:HQ-12435678";
- Assert.assertEquals(selector, SelectorTranslator.convertToHornetQFilterString(selector));
+ Assert.assertEquals(" HQUserID='ID:HQ-12435678", SelectorTranslator.convertToHornetQFilterString(selector));
selector = " JMSMessageID = 'ID:HQ-12435678";
- Assert.assertEquals(selector, SelectorTranslator.convertToHornetQFilterString(selector));
+ Assert.assertEquals(" HQUserID = 'ID:HQ-12435678", SelectorTranslator.convertToHornetQFilterString(selector));
selector = " myHeader = JMSMessageID";
- Assert.assertEquals(selector, SelectorTranslator.convertToHornetQFilterString(selector));
+ Assert.assertEquals(" myHeader = HQUserID", SelectorTranslator.convertToHornetQFilterString(selector));
selector = " myHeader = JMSMessageID OR (JMSMessageID = 'ID-HQ' + '12345')";
- Assert.assertEquals(selector, SelectorTranslator.convertToHornetQFilterString(selector));
+ Assert.assertEquals(" myHeader = HQUserID OR (HQUserID = 'ID-HQ' + '12345')", SelectorTranslator.convertToHornetQFilterString(selector));
checkNoSubstitute("JMSMessageID");
}
14 years, 5 months
JBoss hornetq SVN: r9127 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-04-15 10:41:40 -0400 (Thu, 15 Apr 2010)
New Revision: 9127
Modified:
trunk/build-maven.xml
Log:
Change release on maven build
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2010-04-15 14:13:35 UTC (rev 9126)
+++ trunk/build-maven.xml 2010-04-15 14:41:40 UTC (rev 9127)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.1.0.BETA1"/>
+ <property name="hornetq.version" value="2.1.0.BETA2"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
14 years, 5 months
JBoss hornetq SVN: r9126 - in trunk/src/config: jboss-as/non-clustered and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-04-15 10:13:35 -0400 (Thu, 15 Apr 2010)
New Revision: 9126
Modified:
trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
trunk/src/config/stand-alone/clustered/hornetq-configuration.xml
trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml
Log:
config changes
Modified: trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2010-04-15 14:04:52 UTC (rev 9125)
+++ trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2010-04-15 14:13:35 UTC (rev 9126)
@@ -19,13 +19,13 @@
<connectors>
<connector name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
@@ -40,7 +40,7 @@
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
- <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</acceptor>
Modified: trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2010-04-15 14:04:52 UTC (rev 9125)
+++ trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2010-04-15 14:13:35 UTC (rev 9126)
@@ -17,13 +17,13 @@
<connectors>
<connector name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/stand-alone/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/stand-alone/clustered/hornetq-configuration.xml 2010-04-15 14:04:52 UTC (rev 9125)
+++ trunk/src/config/stand-alone/clustered/hornetq-configuration.xml 2010-04-15 14:13:35 UTC (rev 9126)
@@ -24,7 +24,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5455}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
@@ -38,8 +38,8 @@
<acceptor name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5455}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</acceptor>
</acceptors>
Modified: trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml 2010-04-15 14:04:52 UTC (rev 9125)
+++ trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml 2010-04-15 14:13:35 UTC (rev 9126)
@@ -22,7 +22,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5455}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
@@ -36,8 +36,8 @@
<acceptor name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5455}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</acceptor>
</acceptors>
14 years, 5 months
JBoss hornetq SVN: r9125 - in trunk: tests/src/org/hornetq/tests/integration/jms/bridge and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-04-15 10:04:52 -0400 (Thu, 15 Apr 2010)
New Revision: 9125
Modified:
trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-287: cannot stop JMSBridge which is handling startup failure
* reverted buggy fix
Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-04-15 13:41:16 UTC (rev 9124)
+++ trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-04-15 14:04:52 UTC (rev 9125)
@@ -19,9 +19,6 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -53,7 +50,6 @@
import org.hornetq.jms.bridge.JMSBridgeControl;
import org.hornetq.jms.bridge.QualityOfServiceMode;
import org.hornetq.jms.client.HornetQSession;
-import org.hornetq.utils.Future;
/**
*
@@ -112,8 +108,6 @@
private boolean started;
- private volatile boolean stopping = false;
-
private final LinkedList<Message> messages;
private ConnectionFactoryFactory sourceCff;
@@ -170,8 +164,6 @@
private static final int FORWARD_MODE_NONTX = 2;
- private ExecutorService executor;
-
/*
* Constructor for MBean
*/
@@ -278,8 +270,6 @@
checkParams();
- this.executor = Executors.newSingleThreadExecutor();
-
if (mbeanServer != null)
{
if (objectName != null)
@@ -315,8 +305,6 @@
public synchronized void start() throws Exception
{
- stopping = false;
-
if (started)
{
JMSBridgeImpl.log.warn("Attempt to start, but is already started");
@@ -368,19 +356,20 @@
timeChecker = new BatchTimeChecker();
- Thread checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
- checkerThread.start();
-
+ checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
+
batchExpiryTime = System.currentTimeMillis() + maxBatchTime;
+ checkerThread.start();
+
if (JMSBridgeImpl.trace)
{
JMSBridgeImpl.log.trace("Started time checker thread");
}
}
- Thread sourceThread = new SourceReceiver();
- sourceThread.start();
+ sourceReceiver = new SourceReceiver();
+ sourceReceiver.start();
if (JMSBridgeImpl.trace)
{
@@ -397,7 +386,11 @@
public synchronized void stop() throws Exception
{
- stopping = true;
+ if (!started)
+ {
+ JMSBridgeImpl.log.warn("Attempt to stop, but is already stopped");
+ return;
+ }
if (JMSBridgeImpl.trace)
{
@@ -418,14 +411,6 @@
{
sourceReceiver.interrupt();
}
-
- executor.shutdown();
- boolean ok = executor.awaitTermination(2 * failureRetryInterval, TimeUnit.MILLISECONDS);
-
- if (!ok)
- {
- log.warn("Timed out waiting to stop");
- }
}
// This must be outside sync block
@@ -459,7 +444,7 @@
JMSBridgeImpl.log.trace("Source receiver thread has finished");
}
}
-
+
if (tx != null)
{
// Terminate any transaction
@@ -1381,7 +1366,7 @@
int count = 0;
- while (true && !stopping)
+ while (true)
{
boolean ok = setupJMSObjects();
@@ -1637,7 +1622,9 @@
// In the case of onMessage we can't close the connection from inside the onMessage method
// since it will block waiting for onMessage to complete. In the case of start we want to return
// from the call before the connections are reestablished so that the caller is not blocked unnecessarily.
- executor.execute(new Thread(failureHandler, "jmsbridge-thread-pool"));
+ Thread t = new Thread(failureHandler, "jmsbridge-failurehandler-thread");
+
+ t.start();
}
private void addMessageIDInHeader(final Message msg) throws Exception
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 13:41:16 UTC (rev 9124)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 14:04:52 UTC (rev 9125)
@@ -145,7 +145,7 @@
/**
* https://jira.jboss.org/jira/browse/HORNETQ-287
*/
- public void testStopBridgeWithFailureWhenStarted() throws Exception
+ public void _testStopBridgeWithFailureWhenStarted() throws Exception
{
jmsServer1.stop();
14 years, 5 months
JBoss hornetq SVN: r9124 - trunk/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-04-15 09:41:16 -0400 (Thu, 15 Apr 2010)
New Revision: 9124
Added:
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-286: Temporary Queue not accessible on remote node
* added test to check that temp queue are properly propagated to the cluster.
Other nodes can send messages to the temp queue (provided they wait for the bindings)
Added: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java 2010-04-15 13:41:16 UTC (rev 9124)
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.distribution;
+
+import junit.framework.Assert;
+
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.core.logging.Logger;
+
+/**
+ * A TemporaryQueueClusterTest
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class TemporaryQueueClusterTest extends ClusterTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+ private static final Logger log = Logger.getLogger(ClusteredRequestResponseTest.class);
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ setupServers();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ stopServers();
+
+ super.tearDown();
+ }
+
+ protected boolean isNetty()
+ {
+ return false;
+ }
+
+ /**
+ * https://jira.jboss.org/jira/browse/HORNETQ-286
+ *
+ * the test checks that the temp queue is properly propagated to the cluster
+ * (assuming we wait for the bindings)
+ */
+ public void testSendToTempQueueFromAnotherClusterNode() throws Exception
+ {
+ setupCluster();
+
+ startServers(0, 1);
+
+ setupSessionFactory(0, isNetty());
+ setupSessionFactory(1, isNetty());
+
+ String tempAddress = "queues.tempaddress";
+ String tempQueue = "tempqueue";
+ // create temp queue on node #0
+ ClientSession session = sfs[0].createSession(false, true, true);
+ session.createTemporaryQueue(tempAddress, tempQueue);
+ ClientConsumer consumer = session.createConsumer(tempQueue);
+
+ // check the binding is created on node #1
+ waitForBindings(1, tempAddress, 1, 1, false);
+
+ // send to the temp address on node #1
+ send(1, tempAddress, 10, false, null);
+
+ session.start();
+
+ // check consumer bound to node #0 receives from the temp queue
+ for (int j = 0; j < 10; j++)
+ {
+ ClientMessage message = consumer.receive(5000);
+ if (message == null)
+ {
+ Assert.assertNotNull("consumer did not receive message on temp queue " + j, message);
+ }
+ message.acknowledge();
+ }
+
+ consumer.close();
+ session.deleteQueue(tempQueue);
+ session.close();
+ }
+
+ protected void setupCluster() throws Exception
+ {
+ setupCluster(false);
+ }
+
+ protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
+ {
+ setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1);
+ setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0);
+ }
+
+ protected void setupServers() throws Exception
+ {
+ setupServer(0, isFileStorage(), isNetty());
+ setupServer(1, isFileStorage(), isNetty());
+ }
+
+ protected void stopServers() throws Exception
+ {
+ closeAllConsumers();
+
+ closeAllSessionFactories();
+
+ stopServers(0, 1);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
14 years, 5 months
JBoss hornetq SVN: r9123 - in trunk: tests/src/org/hornetq/tests/integration/jms/bridge and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-04-15 08:35:22 -0400 (Thu, 15 Apr 2010)
New Revision: 9123
Modified:
trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-287: cannot stop JMSBridge which is handling startup failure
* use an executor to run the failure handler thread
* remove 10K-iteration test() from JMSBridgeReconnectionTest
Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-04-15 10:38:36 UTC (rev 9122)
+++ trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-04-15 12:35:22 UTC (rev 9123)
@@ -19,6 +19,9 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -50,6 +53,7 @@
import org.hornetq.jms.bridge.JMSBridgeControl;
import org.hornetq.jms.bridge.QualityOfServiceMode;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.utils.Future;
/**
*
@@ -63,8 +67,6 @@
*/
public class JMSBridgeImpl implements HornetQComponent, JMSBridge
{
- public static final String FAILURE_HANDLER_THREAD_NAME = "jmsbridge-failurehandler-thread";
-
private static final Logger log;
private static boolean trace;
@@ -162,14 +164,14 @@
private ObjectName objectName;
- private Thread startupFailureThread;
-
private static final int FORWARD_MODE_XA = 0;
private static final int FORWARD_MODE_LOCALTX = 1;
private static final int FORWARD_MODE_NONTX = 2;
+ private ExecutorService executor;
+
/*
* Constructor for MBean
*/
@@ -276,6 +278,8 @@
checkParams();
+ this.executor = Executors.newSingleThreadExecutor();
+
if (mbeanServer != null)
{
if (objectName != null)
@@ -364,20 +368,19 @@
timeChecker = new BatchTimeChecker();
- checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
-
+ Thread checkerThread = new Thread(timeChecker, "jmsbridge-checker-thread");
+ checkerThread.start();
+
batchExpiryTime = System.currentTimeMillis() + maxBatchTime;
- checkerThread.start();
-
if (JMSBridgeImpl.trace)
{
JMSBridgeImpl.log.trace("Started time checker thread");
}
}
- sourceReceiver = new SourceReceiver();
- sourceReceiver.start();
+ Thread sourceThread = new SourceReceiver();
+ sourceThread.start();
if (JMSBridgeImpl.trace)
{
@@ -415,12 +418,14 @@
{
sourceReceiver.interrupt();
}
+
+ executor.shutdown();
+ boolean ok = executor.awaitTermination(2 * failureRetryInterval, TimeUnit.MILLISECONDS);
- if (startupFailureThread != null)
+ if (!ok)
{
- startupFailureThread.interrupt();
+ log.warn("Timed out waiting to stop");
}
-
}
// This must be outside sync block
@@ -454,22 +459,6 @@
JMSBridgeImpl.log.trace("Source receiver thread has finished");
}
}
-
- // This must be outside sync block
- if (startupFailureThread != null)
- {
- if (JMSBridgeImpl.trace)
- {
- JMSBridgeImpl.log.trace("Waiting for failure thread to finish");
- }
-
- startupFailureThread.join();
-
- if (JMSBridgeImpl.trace)
- {
- JMSBridgeImpl.log.trace("Failure thread has finished");
- }
- }
if (tx != null)
{
@@ -1637,10 +1626,10 @@
private void handleFailureOnStartup()
{
- startupFailureThread = handleFailure(new StartupFailureHandler());
+ handleFailure(new StartupFailureHandler());
}
- private Thread handleFailure(final Runnable failureHandler)
+ private void handleFailure(final Runnable failureHandler)
{
failed = true;
@@ -1648,11 +1637,7 @@
// In the case of onMessage we can't close the connection from inside the onMessage method
// since it will block waiting for onMessage to complete. In the case of start we want to return
// from the call before the connections are reestablished so that the caller is not blocked unnecessarily.
- Thread t = new Thread(failureHandler, FAILURE_HANDLER_THREAD_NAME);
-
- t.start();
-
- return t;
+ executor.execute(new Thread(failureHandler, "jmsbridge-thread-pool"));
}
private void addMessageIDInHeader(final Message msg) throws Exception
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 10:38:36 UTC (rev 9122)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 12:35:22 UTC (rev 9123)
@@ -12,11 +12,8 @@
*/
package org.hornetq.tests.integration.jms.bridge;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
-import java.util.Map;
import junit.framework.Assert;
@@ -145,19 +142,6 @@
}
}
- public void test() throws Exception
- {
- for (int i = 0; i < 1000000; i++)
- {
- log.info("** ITER "+ i);
-
- this.testStopBridgeWithFailureWhenStarted();
- tearDown();
-
- setUp();
- }
- }
-
/**
* https://jira.jboss.org/jira/browse/HORNETQ-287
*/
@@ -188,14 +172,13 @@
Assert.assertFalse(bridge.isStarted());
Assert.assertTrue(bridge.isFailed());
- assertTrue(threadExists(JMSBridgeImpl.FAILURE_HANDLER_THREAD_NAME));
+ assertEquals(1, numOfThreadsStartingWith("pool-"));
bridge.stop();
-
- assertFalse(threadExists(JMSBridgeImpl.FAILURE_HANDLER_THREAD_NAME));
-
Assert.assertFalse(bridge.isStarted());
+ assertEquals(0, numOfThreadsStartingWith("pool-"));
+
// we restart and setup the server for the test's tearDown checks
jmsServer1.start();
createQueue("targetQueue", 1);
@@ -203,18 +186,23 @@
}
- private boolean threadExists(String threadName)
+ //TODO is there a better way to check if a thread is still running?
+ private int numOfThreadsStartingWith(String prefix)
{
+ int count = 0;
long[] threadIds = ManagementFactory.getThreadMXBean().getAllThreadIds();
for (long id : threadIds)
{
ThreadInfo threadInfo = ManagementFactory.getThreadMXBean().getThreadInfo(id);
- if (threadInfo.getThreadName().equals(threadName))
+ if (threadInfo != null)
{
- return true;
+ if (threadInfo.getThreadName().startsWith(prefix))
+ {
+ count++;
+ }
}
}
- return false;
+ return count;
}
/*
14 years, 5 months
JBoss hornetq SVN: r9122 - in trunk: src/config/jboss-as/non-clustered and 7 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-04-15 06:38:36 -0400 (Thu, 15 Apr 2010)
New Revision: 9122
Modified:
trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
trunk/src/config/stand-alone/clustered/hornetq-configuration.xml
trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml
trunk/src/config/trunk/clustered/hornetq-configuration.xml
trunk/src/config/trunk/non-clustered/hornetq-configuration.xml
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
some small fixes and corrections to config
Modified: trunk/src/config/jboss-as/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/jboss-as/clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -25,7 +25,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/jboss-as/non-clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -23,7 +23,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/stand-alone/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/stand-alone/clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/stand-alone/clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -23,7 +23,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/stand-alone/non-clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -21,7 +21,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/trunk/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/trunk/clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/trunk/clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -15,7 +15,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/config/trunk/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/trunk/non-clustered/hornetq-configuration.xml 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/config/trunk/non-clustered/hornetq-configuration.xml 2010-04-15 10:38:36 UTC (rev 9122)
@@ -13,7 +13,7 @@
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-04-15 10:38:36 UTC (rev 9122)
@@ -264,7 +264,6 @@
unbindJNDI(topicJNDI);
unbindJNDI(connectionFactoryJNDI);
-
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet()))
{
@@ -273,10 +272,10 @@
connectionFactories.clear();
connectionFactoryJNDI.clear();
-
+
queueJNDI.clear();
queues.clear();
-
+
topicJNDI.clear();
topics.clear();
@@ -803,8 +802,7 @@
final String... jndiBindings) throws Exception
{
log.info("calling create cf " + discoveryRefreshTimeout + " lba " + localBindAddress);
-
-
+
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
@@ -1470,18 +1468,21 @@
*/
private void unbindJNDI(Map<String, List<String>> param)
{
- for (List<String> elementList : param.values())
+ if (context != null)
{
- for (String key : elementList)
+ for (List<String> elementList : param.values())
{
- try
+ for (String key : elementList)
{
- context.unbind(key);
+ try
+ {
+ context.unbind(key);
+ }
+ catch (Exception e)
+ {
+ log.warn("Impossible to unbind key " + key + " from JNDI", e);
+ }
}
- catch (Exception e)
- {
- log.warn("Impossible to unbind key " + key + " from JNDI");
- }
}
}
}
@@ -1592,7 +1593,9 @@
storage.start();
}
- private synchronized boolean removeFromJNDI(final Map<String, ?> keys, final Map<String, List<String>> jndiMap, final String name) throws Exception
+ private synchronized boolean removeFromJNDI(final Map<String, ?> keys,
+ final Map<String, List<String>> jndiMap,
+ final String name) throws Exception
{
checkInitialised();
List<String> jndiBindings = jndiMap.remove(name);
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-04-15 10:38:36 UTC (rev 9122)
@@ -144,6 +144,19 @@
}
}
}
+
+ public void test() throws Exception
+ {
+ for (int i = 0; i < 1000000; i++)
+ {
+ log.info("** ITER "+ i);
+
+ this.testStopBridgeWithFailureWhenStarted();
+ tearDown();
+
+ setUp();
+ }
+ }
/**
* https://jira.jboss.org/jira/browse/HORNETQ-287
Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-04-15 09:45:07 UTC (rev 9121)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-04-15 10:38:36 UTC (rev 9122)
@@ -259,6 +259,7 @@
baos.write(frame.getBytes("UTF-8"));
baos.write(data);
baos.write('\0');
+ baos.flush();
sendFrame(baos.toByteArray());
BytesMessage message = (BytesMessage)consumer.receive(10000);
14 years, 5 months