handlersCopy[i] = handlers.get(handlers.size() - i - 1);
}
handlers.clear();
FutureLatch future = new FutureLatch(handlersCopy.length);
List<Thread> interruptThreads = new ArrayList<>();
for (HornetQMessageHandler handler : handlersCopy)
{
Thread thread = handler.interruptConsumer(future);
if (thread != null)
{
interruptThreads.add(thread);
}
}
//wait for all the consumers to complete any onmessage calls
boolean stuckThreads = !future.await(factory.getCallTimeout());
//if any are stuck then we need to interrupt them
if (stuckThreads)
{
for (Thread interruptThread : interruptThreads)
{