Search in sources :

Example 1 with ThreadSpawner

use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.

the class Provisioner method installSimulator.

void installSimulator() {
    onlineCheckAgents(properties, registry);
    ensureIsRemoteSetup(properties, "install");
    long started = System.nanoTime();
    logWithRuler("Installing Simulator on %d machines...", registry.agentCount());
    ThreadSpawner spawner = new ThreadSpawner("installSimulator", true);
    for (final AgentData agent : registry.getAgents()) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                log("    Installing Simulator on %s", agent.getPublicAddress());
                installSimulator(agent.getPublicAddress());
                log("    Finished installing Simulator on %s", agent.getPublicAddress());
            }
        });
    }
    spawner.awaitCompletion();
    long elapsed = getElapsedSeconds(started);
    logWithRuler("Finished installing Simulator on %d machines (%s seconds)", registry.agentCount(), elapsed);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 2 with ThreadSpawner

use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.

the class Provisioner method installJava.

void installJava() {
    onlineCheckAgents(properties, registry);
    ensureIsRemoteSetup(properties, "installJava");
    long started = System.nanoTime();
    logWithRuler("Installing Java on %d machines...", registry.agentCount());
    ThreadSpawner spawner = new ThreadSpawner("installJava", true);
    for (final AgentData agent : registry.getAgents()) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                log("Installing Java on %s", agent.getPublicAddress());
                installJava(agent.getPublicAddress());
            }
        });
    }
    spawner.awaitCompletion();
    long elapsed = getElapsedSeconds(started);
    logWithRuler("Finished installing Java on %d machines (%s seconds)", registry.agentCount(), elapsed);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 3 with ThreadSpawner

use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.

the class MapTransactionContextConflictTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int i = 0; i < threadCount; i++) {
        spawner.spawn(new Worker());
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 4 with ThreadSpawner

use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.

the class MapDataIntegrityTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int i = 0; i < mapIntegrityThreadCount; i++) {
        integrityThreads[i] = new MapIntegrityThread();
        spawner.spawn(integrityThreads[i]);
    }
    for (int i = 0; i < stressThreadCount; i++) {
        spawner.spawn(new StressThread());
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Example 5 with ThreadSpawner

use of com.hazelcast.simulator.utils.ThreadSpawner in project hazelcast-simulator by hazelcast.

the class QueueTest method run.

@Run
public void run() {
    ThreadSpawner spawner = new ThreadSpawner(name);
    for (int queueIndex = 0; queueIndex < queueLength; queueIndex++) {
        for (int i = 0; i < threadsPerQueue; i++) {
            spawner.spawn(new Worker(queueIndex));
        }
    }
    spawner.awaitCompletion();
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner) Run(com.hazelcast.simulator.test.annotations.Run)

Aggregations

ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)14 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)5 Run (com.hazelcast.simulator.test.annotations.Run)5 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)1 TestCaseRunner (com.hazelcast.simulator.coordinator.TestCaseRunner)1 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1