0
在多線程/多應用程序環境中使用Oracle Streams AQ僅在一個線程中運行約10分鐘後收到AQOracleSQLException
:Exhausted Resultset。Oracle Streams AQ。 session.getQueue拋出AQOracleSQLException:Exhausted Resultset
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/MessageManagerDB"/>
</bean>
<bean id="aqSessionFactory" class="au.com.xxx.queue.AQSessionFactory">
<constructor-arg ref="dataSource"/>
</bean>
<bean id="aqSessionTarget" factory-bean="aqSessionFactory"
factory-method="createAQSession" scope="prototype"/>
<bean id="aqSessionPoolTargetSource"
class="org.springframework.aop.target.CommonsPoolTargetSource">
<property name="targetBeanName" value="aqSessionTarget"/>
<property name="maxSize" value="25"/>
</bean>
<bean id="aqSession" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource" ref="aqSessionPoolTargetSource"/>
</bean>
隨着工廠方法createAQSession
是(Scala中)::
oracle.AQ.AQOracleSQLException: Exhausted Resultset
at oracle.AQ.AQOracleSession.getQueue(AQOracleSession.java:751)
at au.com.xxx.queue.OracleQueue$$anonfun$2.apply(OracleQueue.scala:53)
的AQOracleSession
經由彈簧如下彙集
def createAQSession = {
val wasConnection = dataSource.getConnection.asInstanceOf[WSJdbcConnection]
val connection = WSCallHelper.getNativeConnection(wasConnection).asInstanceOf[Connection]
SessionWithConnection(AQDriverManager.createAQSession(connection), connection)
// SessionWithConnection is just a case class akin to
// Tuple2[AQOracleSession, Connection]
}
的異常是從最後行拋此塊:
def sessionAndConnection = {
applicationContext.getBean("aqSession").asInstanceOf[SessionWithConnectionI]
}
def write(category: String, relatedId: Option[String], payload: String): Array[Byte] = {
val (session, conn) = {
val sc = sessionAndConnection
(sc.session, sc.connection)
}
val queueDef = dao.queueForWriting(category, relatedId).map{_.name}
val queue = queueDef.map{name => session.getQueue("QUSR", name)}
很明顯,我不是直接處理AQOracleSession
內使用的ResultSet
。
我上午使用與Session
相關的Connection
,但這不是直到後來在同樣的方法,所以不能在這裏有毛病:
val clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION)
是否有可能彙集配置不正確,並且在同一個會話中有一些併發操作?其他日誌中沒有任何異常。