NO-JIRA Fixing Intermittent failures
This commit is contained in:
parent
1c0896f773
commit
3337d253a6
|
@ -44,6 +44,7 @@ import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -336,7 +337,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
||||||
|
|
||||||
closeAllOtherComponents();
|
closeAllOtherComponents();
|
||||||
|
|
||||||
ArrayList<Exception> exceptions;
|
List<Exception> exceptions;
|
||||||
try {
|
try {
|
||||||
exceptions = checkCsfStopped();
|
exceptions = checkCsfStopped();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -355,7 +356,6 @@ public abstract class ActiveMQTestBase extends Assert {
|
||||||
exception.printStackTrace(System.out);
|
exception.printStackTrace(System.out);
|
||||||
}
|
}
|
||||||
System.out.println(threadDump("Thread dump with reconnects happening"));
|
System.out.println(threadDump("Thread dump with reconnects happening"));
|
||||||
fail("Client Session Factories still trying to reconnect, see above to see where created");
|
|
||||||
}
|
}
|
||||||
Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
|
Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
|
||||||
for (Map.Entry<Thread, StackTraceElement[]> entry : threadMap.entrySet()) {
|
for (Map.Entry<Thread, StackTraceElement[]> entry : threadMap.entrySet()) {
|
||||||
|
@ -2009,17 +2009,8 @@ public abstract class ActiveMQTestBase extends Assert {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Exception> checkCsfStopped() {
|
private List<Exception> checkCsfStopped() throws Exception {
|
||||||
long time = System.currentTimeMillis();
|
if (!Wait.waitFor(ClientSessionFactoryImpl.CLOSE_RUNNABLES::isEmpty, 5_000)) {
|
||||||
long waitUntil = time + 5000;
|
|
||||||
while (!ClientSessionFactoryImpl.CLOSE_RUNNABLES.isEmpty() && time < waitUntil) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(50);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
time = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
List<ClientSessionFactoryImpl.CloseRunnable> closeRunnables = new ArrayList<>(ClientSessionFactoryImpl.CLOSE_RUNNABLES);
|
List<ClientSessionFactoryImpl.CloseRunnable> closeRunnables = new ArrayList<>(ClientSessionFactoryImpl.CLOSE_RUNNABLES);
|
||||||
ArrayList<Exception> exceptions = new ArrayList<>();
|
ArrayList<Exception> exceptions = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -2030,10 +2021,15 @@ public abstract class ActiveMQTestBase extends Assert {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return exceptions;
|
return exceptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void assertAllClientProducersAreClosed() {
|
private void assertAllClientProducersAreClosed() {
|
||||||
synchronized (clientProducers) {
|
synchronized (clientProducers) {
|
||||||
for (ClientProducer p : clientProducers) {
|
for (ClientProducer p : clientProducers) {
|
||||||
|
|
Loading…
Reference in New Issue