はい、あなたは、接続プールの周りにラッパークラスを書くことができ、かつ接続 周りwraperはそうあなたが持って言うことができます:
OracleConnection conn=connectionPool.getConnection("java:[email protected]");
変更し、それはへ:
public class LoggingConnectionPool extends ConnectionPool{
public OracleConnection getConnection(String datasourceName, String module, String action){
OracleConnection conn=getConnection(datasourceName);
CallableStatement call=conn.preparedCall("begin dbms_application_info.setModule(module_name => ?, action_name => ?); end;");
try{
call.setString(1,module);
call.setString(2,action);
call.execute();
finally{
call.close();
}
return new WrappedOracleConnection(conn);
}
注意上記のWrappedOracleConnectionの使用。あなたは
トラップに近いの呼び出しを必要とするので、あなたは、これは私が閉じていない接続(プールに返されていない)をキャッチするために開発サーバー上の類似した何かを、支援を期待
public class WrappedOracleConnection extends OracleConnection{
public void close(){
CallableStatement call=this.preparedCall("begin dbms_application_info.setModule(module_name => ?, action_name => ?); end;");
try{
call.setNull(1,Types.VARCHAR);
call.setNull(2,Types.VARCHAR);
call.execute();
finally{
call.close();
}
}
// and you need to implement every other method
//for example
public CallableStatement prepareCall(String command){
return super.prepareCall(command);
}
...
}
これを必要としています。