我在WebSphere 7.0.0.21上部署了消息驅動Bean(MDB),它在SIB(服務集成總線)隊列上發送JMS消息。創建爲什麼SIB連接關閉? (Websphere服務集成總線)
的JMS資源:
@Resource(name = CONN_FACTORY, mappedName = CONN_FACTORY)
private QueueConnectionFactory connFactory;
@PostConstruct
public void postConstruct() {
queueConnection = connFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
responseQueueSender = queueSession.createSender(getResponseQueue());
}
毀壞。
@PreDestroy
public void preDestroy() {
responseQueueSender.close();
queueSession.close();
queueConnection.close();
}
發送這樣的:
TextMessage responseMessage = queueSession.createTextMessage("message");
responseQueueSender.send(responseMessage, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, expirationTime);
queueSession.commit();
我有大約20我的MDB的實例。當我向MDB生成大量傳入消息時,會出現問題。我得到了以下錯誤:
CWSIA0053E: An exception was received during the call to the method JmsSessionImpl.getTransaction (#1): javax.resource.spi.IllegalStateException: CWSJR1121E: An internal error has occurred. During the call to the method getManagedConnection the exception javax.resource.spi.ResourceAllocationException: CWSJR1028E: An internal error has occurred. The exception com.ibm.ws.sib.processor.exceptions.SIMPConnectionUnavailableException: CWSIK0022E: The connection is closed to messaging engine seit3022Node01.server1-Payment and cannot be used. was received in method createManagedConnection. was thrown..
如果我增加了很多,誤差更很少發生隊列連接工廠的連接池的大小,但它仍然存在。如果我降低池的大小,錯誤會經常發生。
連接如何關閉?如果我的連接池大小大於併發MDB數:連接如何關閉?
有連接池的各種屬性,但我無法找到任何使用就關閉連接......而我的代碼絕對不會關閉任何連接(除了@PreDestroy
)
根據Oracle的Java EE教程(http://docs.oracle.com/javaee/6/tutorial/doc/bncgl.html),兩種管理資源的方式(以onMessage()或上述方式)都是正確。我嘗試在onMessage()中管理資源,它的工作原理沒有錯誤,但性能實際上明顯較低! (消耗1000條消息(包括業務邏輯)耗時約50%。) – DagR