Search in sources :

Example 6 with ThreadSpawner

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

the class WorkerProcessManager method shutdown.

public void shutdown() {
    executorService.shutdown();
    ThreadSpawner spawner = new ThreadSpawner("workerJvmManagerShutdown", true);
    for (final WorkerProcess workerProcess : new ArrayList<WorkerProcess>(workerProcesses.values())) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                shutdown(workerProcess);
            }
        });
    }
    spawner.awaitCompletion();
}
Also used : ArrayList(java.util.ArrayList) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 7 with ThreadSpawner

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

the class TimeStepRunStrategy method spawnThreads.

private ThreadSpawner spawnThreads(TimeStepRunner[] runners) {
    ThreadSpawner spawner = new ThreadSpawner(testContext.getTestId());
    for (TimeStepRunner runner : runners) {
        String executionGroup = runner.executionGroup;
        String name = testContext.getTestId();
        if (!executionGroup.equals("")) {
            name += "-" + executionGroup;
        }
        name += "-timestepThread";
        spawner.spawn(name, runner);
    }
    return spawner;
}
Also used : ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 8 with ThreadSpawner

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

the class GrowingMapTest 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 9 with ThreadSpawner

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

the class ArtifactCleanTask method cleanRemote.

private void cleanRemote() {
    long started = System.nanoTime();
    LOGGER.info(format("Cleaning Worker homes of %s machines...", registry.agentCount()));
    final String cleanCommand = format("rm -fr hazelcast-simulator-%s/workers/*", getSimulatorVersion());
    ThreadSpawner spawner = new ThreadSpawner("clean", true);
    for (final AgentData agent : registry.getAgents()) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                LOGGER.info(format("Cleaning %s", agent.getPublicAddress()));
                bash.ssh(agent.getPublicAddress(), cleanCommand);
            }
        });
    }
    spawner.awaitCompletion();
    long elapsed = getElapsedSeconds(started);
    LOGGER.info(format("Finished cleaning Worker homes of %s machines (%s seconds)", registry.agentCount(), elapsed));
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 10 with ThreadSpawner

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

the class RunTestSuiteTask method runParallel.

private boolean runParallel() {
    final AtomicBoolean success = new AtomicBoolean(true);
    ThreadSpawner spawner = new ThreadSpawner("runParallel", true);
    for (final TestCaseRunner runner : runners) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                try {
                    if (!runner.run()) {
                        success.set(false);
                    }
                } catch (Exception e) {
                    throw rethrow(e);
                }
            }
        });
    }
    spawner.awaitCompletion();
    return success.get();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestCaseRunner(com.hazelcast.simulator.coordinator.TestCaseRunner) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

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