use of com.hazelcast.simulator.agent.operations.StopTimeoutDetectionOperation in project hazelcast-simulator by hazelcast.
the class AgentOperationProcessorTest method testStopTimeoutDetectionOperation.
@Test
public void testStopTimeoutDetectionOperation() throws Exception {
StopTimeoutDetectionOperation op = new StopTimeoutDetectionOperation();
processor.process(op, source, promise);
verify(failureMonitor).stopTimeoutDetection();
}
use of com.hazelcast.simulator.agent.operations.StopTimeoutDetectionOperation in project hazelcast-simulator by hazelcast.
the class TerminateWorkersTask method run0.
private void run0() throws TimeoutException, InterruptedException, ExecutionException {
int currentWorkerCount = registry.workerCount();
if (currentWorkerCount == 0) {
return;
}
LOGGER.info(format("Terminating %d Workers...", currentWorkerCount));
client.invokeOnAllAgents(new StopTimeoutDetectionOperation(), MINUTES.toMillis(1));
// prevent any failures from being printed due to killing the members.
Set<WorkerData> clients = new HashSet<WorkerData>();
Set<WorkerData> members = new HashSet<WorkerData>();
for (WorkerData worker : registry.getWorkers()) {
worker.setIgnoreFailures(true);
if (worker.getParameters().getWorkerType().equals("member")) {
members.add(worker);
} else {
clients.add(worker);
}
}
// first shut down all clients
for (WorkerData worker : clients) {
client.send(worker.getAddress(), new TerminateWorkerOperation(true));
}
// wait some if there were any clients
if (!clients.isEmpty()) {
sleepSeconds(simulatorProperties.getMemberWorkerShutdownDelaySeconds());
}
// and then terminate all members
for (WorkerData worker : members) {
client.send(worker.getAddress(), new TerminateWorkerOperation(true));
}
// now we wait for the workers to die
waitForWorkerShutdown(currentWorkerCount);
}
Aggregations