}
public static void main(String[] args) throws Exception
{
TestConfiguration config = new JVMArgConfiguration();
MercuryReporter reporter= new MercuryReporter(MercuryThroughput.class,System.out,10,true);
String scriptId = (args.length == 1) ? args[0] : "";
int conCount = config.getConnectionCount();
final CountDownLatch testCompleted = new CountDownLatch(conCount);
for (int i=0; i < conCount; i++)
{
final MercuryProducerController prod = new MercuryProducerController(config, reporter, scriptId + i);
prod.startControllerIfNeeded();
Runnable r = new Runnable()
{
public void run()
{
prod.run();
testCompleted.countDown();
}
};
Thread t;
try
{
t = Threading.getThreadFactory().createThread(r);
}
catch(Exception e)
{
throw new Error("Error creating producer thread",e);
}
t.start();
}
testCompleted.await();
reporter.log("Producers have completed the test......");
}