}
@Test
public void testConcurrentRegistryAddRemove() throws Exception
{
final RegistryBroker broker = new DefaultRegistryBroker(muleContext);
final int N = 50;
final CountDownLatch start = new CountDownLatch(1);
final CountDownLatch end = new CountDownLatch(N);
final AtomicInteger errors = new AtomicInteger(0);
for (int i = 0; i < N; i++)
{
new Thread(new Runnable()
{
@Override
public void run()
{
try
{
start.await();
broker.addRegistry(new TransientRegistry(muleContext));
broker.lookupByType(Object.class);
}
catch (Exception e)
{
errors.incrementAndGet();
}