latch.countDown();
}
}, "topic" + runs);
ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(BATCH_SIZE+1);
ThreadPoolExecutor executor = new ThreadPoolExecutor(1,
1,
1000,
TimeUnit.MILLISECONDS, workQueue);
for (int i = 0; i < BATCH_SIZE; i++) {
final String topicString = "topic"+runs;
final Hashtable<String,Object> localProperties = new Hashtable<String, Object>();
localProperties.put(topicString,i);
workQueue.add(new Runnable() {
@Override
public void run() {
send(topicString, localProperties, true);
}
});
}
long startTime = System.nanoTime();
executor.prestartAllCoreThreads();
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();