int taskCount = Integer.parseInt(args[1]);
int durationSec = Integer.parseInt(args[2]);
long startMs = System.currentTimeMillis();
IExecutorService executor = hazelcast.getExecutorService("e" + threadCount);
List<Future> futures = new LinkedList<Future>();
List<Member> members = new LinkedList<Member>(hazelcast.getCluster().getMembers());
int totalThreadCount = hazelcast.getCluster().getMembers().size() * threadCount;
int latchId = 0;
for (int k = 0; k < taskCount; k++) {
Member member = members.get(k % members.size());
if (taskCount % totalThreadCount == 0) {
latchId = taskCount / totalThreadCount;
hazelcast.getCountDownLatch("latch" + latchId).trySetCount(totalThreadCount);
}
Future f = executor.submitToMember(new SimulateLoadTask(durationSec, k + 1, "latch" + latchId), member);
futures.add(f);
}
for (Future f : futures) {
try {