Mule ESB:如何管理线程名称?

时间:2014-06-30 08:14:26

标签: java multithreading websphere mule

下面我发布了一个带有Mule ESB 3.4.0的websphere 7.0的SystemOut.log提取。我的骡子流是同步的。它使用“Websphere MQ消息”并为每条消息记录消息“消息消费”,然后做生意......

我的问题:

  • 显然不同的线程共享相同的名称,为什么?

  • 经过很长一段时间没有消息,Mule开始每4条消息增加线程名称。螺纹是否泄漏?

日志格式为:

ThreadId [Date] [ThreadName] : Message

ThreadId来自websphere,而ThreadName来自log4j。

SystemOut.log:

00000018 [25-06-2014 10:56:13] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:14] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:15] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:16] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:16] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:16] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:16] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:16] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:17] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000018 [25-06-2014 10:56:18] [DispatchThread: 1]: Message Consume
00000019 [25-06-2014 10:56:19] [DispatchThread: 1]: Message Consume
00000026 [25-06-2014 11:40:46] [DispatchThread: 2]: Message Consume
00000027 [25-06-2014 11:46:15] [DispatchThread: 2]: Message Consume
00000028 [25-06-2014 11:47:23] [DispatchThread: 2]: Message Consume
00000029 [25-06-2014 12:02:12] [DispatchThread: 2]: Message Consume
0000002b [25-06-2014 12:35:21] [DispatchThread: 3]: Message Consume
0000002c [25-06-2014 12:35:21] [DispatchThread: 3]: Message Consume
0000002d [25-06-2014 14:02:04] [DispatchThread: 3]: Message Consume
0000002e [25-06-2014 15:47:56] [DispatchThread: 3]: Message Consume
0000002f [25-06-2014 18:02:30] [DispatchThread: 4]: Message Consume
00000030 [25-06-2014 20:01:59] [DispatchThread: 4]: Message Consume
00000031 [26-06-2014 00:22:48] [DispatchThread: 4]: Message Consume
00000032 [26-06-2014 10:02:05] [DispatchThread: 4]: Message Consume
00000033 [26-06-2014 14:23:23] [DispatchThread: 5]: Message Consume
00000034 [26-06-2014 14:23:23] [DispatchThread: 5]: Message Consume
00000035 [26-06-2014 14:31:29] [DispatchThread: 5]: Message Consume
00000036 [26-06-2014 14:31:29] [DispatchThread: 5]: Message Consume
00000037 [26-06-2014 15:12:53] [DispatchThread: 6]: Message Consume
00000038 [26-06-2014 15:12:54] [DispatchThread: 6]: Message Consume
00000039 [26-06-2014 15:15:19] [DispatchThread: 6]: Message Consume
0000003a [26-06-2014 15:15:20] [DispatchThread: 6]: Message Consume
0000003b [26-06-2014 15:26:12] [DispatchThread: 7]: Message Consume
0000003c [26-06-2014 15:26:12] [DispatchThread: 7]: Message Consume
0000003d [26-06-2014 15:30:50] [DispatchThread: 7]: Message Consume
0000003e [26-06-2014 15:30:51] [DispatchThread: 7]: Message Consume
0000003f [26-06-2014 15:54:43] [DispatchThread: 8]: Message Consume
00000040 [26-06-2014 15:54:43] [DispatchThread: 8]: Message Consume
00000041 [26-06-2014 16:02:21] [DispatchThread: 8]: Message Consume
00000042 [26-06-2014 16:06:21] [DispatchThread: 8]: Message Consume
00000043 [27-06-2014 02:31:18] [DispatchThread: 9]: Message Consume
00000044 [27-06-2014 09:04:16] [DispatchThread: 9]: Message Consume
00000045 [27-06-2014 09:05:36] [DispatchThread: 9]: Message Consume
00000046 [27-06-2014 09:06:38] [DispatchThread: 9]: Message Consume

骡子线程配置:

<configuration doc:name="Configuration">
    <default-threading-profile maxBufferSize="300" maxThreadsActive="20" maxThreadsIdle="10" threadTTL="60000" poolExhaustedAction="RUN" />
</configuration>

Mule MQ配置:

<spring:bean id="connectionFactory" class="com.ibm.mq.jms.MQXAQueueConnectionFactory">
    <spring:property name="channel" value="${wmq.channel}" />
    <spring:property name="queueManager" value="${wmq.queue.manager}" />
    <spring:property name="transportType" value="1" />
    <spring:property name="connectionNameList" value="${wmq.host.list}" />
</spring:bean>
<jms:websphere-connector name="wmqConnector" username="${wmq.username}"
    password="${wmq.password}" connectionFactory-ref="connectionFactory">
    <reconnect-forever blocking="false" frequency="60000" />
</jms:websphere-connector>

注1: WebSphere MQ配置为具有“wmq.host.list”中的两个服务器的高可用性。

注2:连接使用的类是XA。但是流程中没有指定任何交易。

注3:日志来自我们的制作,我无法在本地重现。

非常感谢你的帮助。

弗朗索瓦

1 个答案:

答案 0 :(得分:1)

Mule使用某些传输的本机线程池(如JMS),而不是创建自己的传输。

在您的情况下,DispatchThread: x个线程来自WMQ客户端。这些线程完全由此客户端管理,即它们由WMQ客户端创建,命名并可能被销毁,而不是由Mule。

这个数字增加的事实并不一定意味着线程泄漏:使用VisualVM或jConsole确定线程数是否实际增加。