}
});
context.start();
final ProducerTemplate template = new DefaultProducerTemplate(context);
template.start();
final String[] values = { "<hello/>", "<hallo/>", "<bonjour/>" };
final Random rnd = new Random();
for (int i = 0; i < 100; i++) {
template.sendBody("direct:a", values[rnd.nextInt(values.length)]);
}
profiler.reset();
long t0 = System.nanoTime();
int nbThreads = 10;
final CountDownLatch latch = new CountDownLatch(nbThreads);
for (int t = 0; t < nbThreads; t++) {
new Thread() {
public void run() {
for (int i = 0; i < 1000; i++) {
template.sendBody("direct:a", values[rnd.nextInt(values.length)]);
}
latch.countDown();
}
}.start();
}