How to set a queue producer timeout?

好久不见. 提交于 2019-12-06 11:23:23

问题


I am testing WebLogic 10.3.1 JMS, but there has a problem.

My Testing step:

  1. Start WebLogic Server
  2. Start JMS Client
  3. Client send a object to WebLogic JMS and server received the object.
  4. Stop WebLogic Server
  5. Send another object to WebLogic JMS.

What I expect is a exception come out, but there have not anything appear and program hanged. Program stopped at:

sender.send(objMsg);

I have add some timeout settings, but still not working:

((WLProducerImpl) sender).setSendTimeout(1000);
((WLConnection) connection).setReconnectPolicy(JMSConstants.RECONNECT_POLICY_PRODUCER);
((WLConnection) connection).setReconnectBlockingMillis(1000);

Is there any way to produce exception in this case? Thank You Very Much.

Best Regards, Chris


回答1:


You can try putting timeout in send method. something similar to following: sender.send(objMsg, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, 10000);




回答2:


I suspect the WebLogic transport is hung and hasn't detected the server has gone - and the send is blocked in the transport. Unless WebLogic JMS are using a separate thread internally, there's no a timeout will help.

IMHO, WebLogic support are the only guys who'll be able to help you on this one (looks like a bug).




回答3:


Solution Found:

Please add these 2 parameters:

-Dsun.net.client.defaultConnectTimeout=30000
-Dsun.net.client.defaultReadTimeout=30000


来源:https://stackoverflow.com/questions/1872894/how-to-set-a-queue-producer-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!