マルチスレッド/マルチアプリ環境でOracle Streams AQを使用するとAQOracleSQLException
、1つのスレッドのみで約10分間操作した後、Exhausted Resultsetを受け取りました。
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
、次のように Spring を介してプールされます。
<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 で) 使用すると、次のようになります。
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)}
明らかに、私はResultSet
used withinを直接扱っていませんAQOracleSession
。
に関連付けられたを使用していますが、これは同じメソッドの後半までではないため、ここで問題が発生することはありません。Connection
Session
val clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION)
プーリング構成が正しくなく、同じセッションでいくつかの同時操作があった可能性はありますか? 他のログにはまったく異常はありませんでした。