@@ -145,8 +145,8 @@ public TestRunner addTags(Collection<String> tags) {
145
145
return this ;
146
146
}
147
147
148
- public TestRunner catchOraStuck ( boolean catchOraStuck ) {
149
- this .options .catchOraStuck = catchOraStuck ;
148
+ public TestRunner oraStuckTimeout ( Integer oraStuckTimeout ) {
149
+ this .options .oraStuckTimeout = oraStuckTimeout ;
150
150
return this ;
151
151
}
152
152
@@ -218,7 +218,7 @@ public void run(Connection conn) throws SQLException {
218
218
219
219
TestRunnerStatement testRunnerStatement = null ;
220
220
try {
221
- testRunnerStatement = ( options .catchOraStuck ) ? initStatementWithTimeout (conn ) : initStatement (conn );
221
+ testRunnerStatement = ( options .oraStuckTimeout > 0 ) ? initStatementWithTimeout (conn , options . oraStuckTimeout ) : initStatement (conn );
222
222
logger .info ("Running tests" );
223
223
testRunnerStatement .execute ();
224
224
logger .info ("Running tests finished." );
@@ -236,15 +236,15 @@ private TestRunnerStatement initStatement( Connection conn ) throws SQLException
236
236
return compatibilityProxy .getTestRunnerStatement (options , conn );
237
237
}
238
238
239
- private TestRunnerStatement initStatementWithTimeout ( Connection conn ) throws OracleCreateStatmenetStuckException , SQLException {
239
+ private TestRunnerStatement initStatementWithTimeout ( Connection conn , int timeout ) throws OracleCreateStatmenetStuckException , SQLException {
240
240
ExecutorService executor = Executors .newSingleThreadExecutor ();
241
241
Callable <TestRunnerStatement > callable = () -> compatibilityProxy .getTestRunnerStatement (options , conn );
242
242
Future <TestRunnerStatement > future = executor .submit (callable );
243
243
244
244
// We want to leave the statement open in case of stuck scenario
245
245
TestRunnerStatement testRunnerStatement = null ;
246
246
try {
247
- testRunnerStatement = future .get (2 , TimeUnit .SECONDS );
247
+ testRunnerStatement = future .get (timeout , TimeUnit .SECONDS );
248
248
} catch (TimeoutException e ) {
249
249
logger .error ("Detected Oracle driver stuck during Statement initialization" );
250
250
executor .shutdownNow ();
0 commit comments