// Thread.currentThread().setContextClassLoader(testLoader);
// try
// {
channel1 = (Channel) factoryMeth.invoke(factory1, factory1Args);
dispatchers[0] = new MessageDispatcher(channel1, handler, handler, handler);
channel1.connect("leaktest");
assertEquals("No classloader leak on channel1 connect", null, handler.getLeakedClassLoader());
channel2 = (Channel) factoryMeth.invoke(factory2, factory2Args);
dispatchers[1] = new MessageDispatcher(channel2, handler, handler, handler);
channel2.connect("leaktest");
assertEquals("No classloader leak on channel2 connect", null, handler.getLeakedClassLoader());
// }
// finally
// {
// Thread.currentThread().setContextClassLoader(ours);
// }
log.info("Channels connected");
ClassLoaderLeakRunner[] runners = new ClassLoaderLeakRunner[numThreads];
for (int i = 0; i < runners.length; i++)
{
MessageDispatcher disp = dispatchers[i % 2];
runners[i] = new ClassLoaderLeakRunner(disp, numLoops, runnerGroup, semaphore);
}
semaphore.acquire(numThreads);