use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.
the class StartWorkersTask method startWorkers.
private void startWorkers(Map<SimulatorAddress, List<WorkerParameters>> deploymentPlan) {
ThreadSpawner spawner = new ThreadSpawner("createWorkers", true);
for (Map.Entry<SimulatorAddress, List<WorkerParameters>> entry : deploymentPlan.entrySet()) {
SimulatorAddress agentAddress = entry.getKey();
AgentData agent = registry.getAgent(agentAddress);
for (WorkerParameters workerParameters : entry.getValue()) {
spawner.spawn(new CreateWorkerOnAgentTask(workerParameters, startupDelayMs * workerStartupIndex, agent));
workerStartupIndex++;
}
}
spawner.awaitCompletion();
}
use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.
the class TimeStepRunStrategy method getRunCallable.
@Override
public Callable getRunCallable() {
return new Callable() {
@Override
public Object call() throws Exception {
try {
LOGGER.info(format("Spawning %d worker threads for running %s", totalThreadCount, testContext.getTestId()));
if (totalThreadCount <= 0) {
return null;
}
runners = createRunners();
onRunStarted();
ThreadSpawner spawner = spawnThreads(runners);
spawner.awaitCompletion();
return null;
} finally {
onRunCompleted();
}
}
};
}
use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.
the class Provisioner method killJavaProcesses.
void killJavaProcesses(final boolean sudo) {
onlineCheckAgents(properties, registry);
ensureIsRemoteSetup(properties, "kill");
long started = System.nanoTime();
logWithRuler("Killing %s Java processes...", registry.agentCount());
ThreadSpawner spawner = new ThreadSpawner("killJavaProcesses", true);
for (final AgentData agent : registry.getAgents()) {
spawner.spawn(new Runnable() {
@Override
public void run() {
log(" Killing Java processes on %s", agent.getPublicAddress());
bash.killAllJavaProcesses(agent.getPublicAddress(), sudo);
}
});
}
spawner.awaitCompletion();
long elapsed = getElapsedSeconds(started);
logWithRuler("Successfully killed %s Java processes (%s seconds)", registry.agentCount(), elapsed);
}
use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.
the class MapTransactionGetForUpdateTest method run.
@Run
public void run() {
ThreadSpawner spawner = new ThreadSpawner(name);
for (int i = 0; i < threadCount; i++) {
spawner.spawn(new Worker());
}
spawner.awaitCompletion();
}
Aggregations