Skip to content

Commit 63e91a4

Browse files
committed
Fix for testBug21934573.
1 parent e0f4c5c commit 63e91a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/java/testsuite/regression/ConnectionRegressionTest.java

+7
Original file line numberDiff line numberDiff line change
@@ -7867,6 +7867,8 @@ public void run() {
78677867
}, testConn.getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(testConn)) + "_thread").start();
78687868
}
78697869

7870+
TestBug21934573ExceptionInterceptor.initialized = true;
7871+
78707872
// Let the two concurrent threads run concurrently for 2secs, at the most, before checking if they hit a deadlock situation.
78717873
// Wait two times 1sec as TestBug21934573ExceptionInterceptor.mainThreadLock.notify() should be called twice (once per secondary thread).
78727874
synchronized (TestBug21934573ExceptionInterceptor.mainThreadLock) {
@@ -7903,6 +7905,7 @@ public void run() {
79037905
* SQLException (not only communication related exceptions) and calls directly methods changing servers lists from ReplicationConnectionGroup.
79047906
*/
79057907
public static class TestBug21934573ExceptionInterceptor implements ExceptionInterceptor {
7908+
static boolean initialized = false;
79067909
static Object mainThreadLock = new Object();
79077910
private static boolean threadIsWaiting = false;
79087911
private static final Set<String> replConnGroupLocks = Collections.synchronizedSet(new HashSet<String>());
@@ -7920,6 +7923,10 @@ public void destroy() {
79207923
}
79217924

79227925
public Exception interceptException(Exception sqlEx) {
7926+
if (!initialized) {
7927+
return sqlEx;
7928+
}
7929+
79237930
// Make sure both threads execute the code after the synchronized block concurrently.
79247931
synchronized (TestBug21934573ExceptionInterceptor.class) {
79257932
if (threadIsWaiting) {

0 commit comments

Comments
 (0)