@@ -145,8 +145,8 @@ public TestRunner addTags(Collection<String> tags) {
145145 return this ;
146146 }
147147
148- public TestRunner catchOraStuck ( boolean catchOraStuck ) {
149- this .options .catchOraStuck = catchOraStuck ;
148+ public TestRunner oraStuckTimeout ( Integer oraStuckTimeout ) {
149+ this .options .oraStuckTimeout = oraStuckTimeout ;
150150 return this ;
151151 }
152152
@@ -218,7 +218,7 @@ public void run(Connection conn) throws SQLException {
218218
219219 TestRunnerStatement testRunnerStatement = null ;
220220 try {
221- testRunnerStatement = ( options .catchOraStuck ) ? initStatementWithTimeout (conn ) : initStatement (conn );
221+ testRunnerStatement = ( options .oraStuckTimeout > 0 ) ? initStatementWithTimeout (conn , options . oraStuckTimeout ) : initStatement (conn );
222222 logger .info ("Running tests" );
223223 testRunnerStatement .execute ();
224224 logger .info ("Running tests finished." );
@@ -236,15 +236,15 @@ private TestRunnerStatement initStatement( Connection conn ) throws SQLException
236236 return compatibilityProxy .getTestRunnerStatement (options , conn );
237237 }
238238
239- private TestRunnerStatement initStatementWithTimeout ( Connection conn ) throws OracleCreateStatmenetStuckException , SQLException {
239+ private TestRunnerStatement initStatementWithTimeout ( Connection conn , int timeout ) throws OracleCreateStatmenetStuckException , SQLException {
240240 ExecutorService executor = Executors .newSingleThreadExecutor ();
241241 Callable <TestRunnerStatement > callable = () -> compatibilityProxy .getTestRunnerStatement (options , conn );
242242 Future <TestRunnerStatement > future = executor .submit (callable );
243243
244244 // We want to leave the statement open in case of stuck scenario
245245 TestRunnerStatement testRunnerStatement = null ;
246246 try {
247- testRunnerStatement = future .get (2 , TimeUnit .SECONDS );
247+ testRunnerStatement = future .get (timeout , TimeUnit .SECONDS );
248248 } catch (TimeoutException e ) {
249249 logger .error ("Detected Oracle driver stuck during Statement initialization" );
250250 executor .shutdownNow ();
0 commit comments