Skip to content

Commit 7c831c7

Browse files
authored
Merge pull request #105 from utPLSQL/bugfix/oracle_stuck_too_greedy
OraStuck Timeout too greedy
2 parents 4bef1ed + 1365583 commit 7c831c7

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ dependencies {
3838
api("com.google.code.findbugs:jsr305:3.0.2")
3939

4040
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
41-
implementation("org.slf4j:slf4j-api:1.7.26")
42-
implementation("com.oracle.ojdbc:ojdbc8:$ojdbcVersion") {
43-
exclude(group = "com.oracle.ojdbc")
41+
implementation("org.slf4j:slf4j-api:1.7.36")
42+
implementation("com.oracle.database.jdbc:ojdbc8:$ojdbcVersion") {
43+
exclude(group = "com.oracle.database.jdbc", module = "ucp")
4444
}
45-
implementation("com.oracle.ojdbc:orai18n:$ojdbcVersion")
45+
implementation("com.oracle.database.nls:orai18n:$ojdbcVersion")
4646

4747
// Use Jupiter test framework
4848
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")

src/main/java/org/utplsql/api/TestRunner.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

src/main/java/org/utplsql/api/TestRunnerOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class TestRunnerOptions {
3030
public boolean randomTestOrder = false;
3131
public Integer randomTestOrderSeed;
3232
public final Set<String> tags = new LinkedHashSet<>();
33-
public boolean catchOraStuck = false;
33+
public Integer oraStuckTimeout = 0;
3434

3535
public String getTagsAsString() {
3636
return String.join(",", tags);

src/main/java/org/utplsql/api/Version.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ public class Version implements Comparable<Version> {
3333
public final static Version V3_1_6 = new Version("3.1.6", 3, 1, 6, 2729, true);
3434
public final static Version V3_1_7 = new Version("3.1.7", 3, 1, 7, 3085, true);
3535
public final static Version V3_1_8 = new Version("3.1.8", 3, 1, 8, 3188, true);
36+
public final static Version V3_1_9 = new Version("3.1.9", 3, 1, 9, 3268, true);
37+
public final static Version V3_1_10 = new Version("3.1.10", 3, 1, 10, 3347, true);
38+
public final static Version V3_1_11 = new Version("3.1.11", 3, 1, 11, 3557, true);
39+
public final static Version V3_1_12 = new Version("3.1.12", 3, 1, 12, 3876, true);
3640
private final static Map<String, Version> knownVersions =
37-
Stream.of(V3_0_0, V3_0_1, V3_0_2, V3_0_3, V3_0_4, V3_1_0, V3_1_1, V3_1_2, V3_1_3, V3_1_4, V3_1_5, V3_1_6, V3_1_7, V3_1_8)
41+
Stream.of(V3_0_0, V3_0_1, V3_0_2, V3_0_3, V3_0_4, V3_1_0, V3_1_1, V3_1_2, V3_1_3, V3_1_4, V3_1_5, V3_1_6, V3_1_7, V3_1_8, V3_1_9, V3_1_10, V3_1_11, V3_1_12)
3842
.collect(toMap(Version::toString, Function.identity()));
39-
public final static Version LATEST = V3_1_8;
43+
public final static Version LATEST = V3_1_12;
4044

4145
private final String origString;
4246
private final Integer major;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy