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.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -336,7 +337,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
|
||||
closeAllOtherComponents();
|
||||
|
||||
ArrayList<Exception> exceptions;
|
||||
List<Exception> exceptions;
|
||||
try {
|
||||
exceptions = checkCsfStopped();
|
||||
} finally {
|
||||
|
@ -355,7 +356,6 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
exception.printStackTrace(System.out);
|
||||
}
|
||||
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();
|
||||
for (Map.Entry<Thread, StackTraceElement[]> entry : threadMap.entrySet()) {
|
||||
|
@ -2009,17 +2009,8 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayList<Exception> checkCsfStopped() {
|
||||
long time = System.currentTimeMillis();
|
||||
long waitUntil = time + 5000;
|
||||
while (!ClientSessionFactoryImpl.CLOSE_RUNNABLES.isEmpty() && time < waitUntil) {
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
//ignore
|
||||
}
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
private List<Exception> checkCsfStopped() throws Exception {
|
||||
if (!Wait.waitFor(ClientSessionFactoryImpl.CLOSE_RUNNABLES::isEmpty, 5_000)) {
|
||||
List<ClientSessionFactoryImpl.CloseRunnable> closeRunnables = new ArrayList<>(ClientSessionFactoryImpl.CLOSE_RUNNABLES);
|
||||
ArrayList<Exception> exceptions = new ArrayList<>();
|
||||
|
||||
|
@ -2030,10 +2021,15 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return exceptions;
|
||||
}
|
||||
|
||||
return Collections.EMPTY_LIST;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void assertAllClientProducersAreClosed() {
|
||||
synchronized (clientProducers) {
|
||||
for (ClientProducer p : clientProducers) {
|
||||
|
|
Loading…
Reference in New Issue