多线程时发生C#JMS应用程序错误

本文关键字:应用程序 错误 C#JMS 多线程 | 更新日期: 2023-09-27 18:21:37

我有一个Visual Studio C#JMS应用程序,它将消息发送到WebLogic队列。程序正在工作,并且在多线程启动时工作,直到线程数超过6为止。如果我运行多达6个线程,它可以正常工作,但7个或更多线程会导致以下异常:

WebLogic.Messaging.Transport.TransportException: Server host/port can not be reached - 
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full 
at WebLogic.Messaging.Physical.T3TransportFactory.CreateT3Transport(String host, Int32 port, TransportUserCfgParameters paras)
at WebLogic.Messaging.Physical.T3TransportFactory.CreateT3Transport(IDictionary`2 paramMap) 
WebLogic.Messaging.Transport.TransportException: Server host/port can not be reached - 
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
at WebLogic.Messaging.Physical.T3TransportFactory.CreateT3Transport(String host, Int32 port, TransportUserCfgParameters paras)
at WebLogic.Messaging.Physical.T3TransportFactory.CreateT3Transport(IDictionary`2 paramMap)

队列永远不会满,消息的消耗速度比发送速度快。每条消息都小于1Kb。

感谢

多线程时发生C#JMS应用程序错误

每次发送消息时创建上下文超过了允许的网络连接数。使用仅创建单个网络连接的共享上下文解决了此问题。请参阅Oracle文档,Oracle Fusion Middleware Using the WebLogic JMS Client for Microsoft.NET for Oracle WebLogic Server"Understanding Socket and Threading Behavior"。