use of io.atomix.protocols.raft.test.protocol.LocalRaftProtocolFactory in project atomix by atomix.
the class RaftPerformanceTest method reset.
/**
* Resets the test state.
*/
private void reset() throws Exception {
totalOperations.set(0);
readCount.set(0);
writeCount.set(0);
shutdown();
members = new ArrayList<>();
clients = new ArrayList<>();
servers = new ArrayList<>();
messagingServices = new ArrayList<>();
addressMap = new ConcurrentHashMap<>();
protocolFactory = new LocalRaftProtocolFactory(PROTOCOL_SERIALIZER);
}
use of io.atomix.protocols.raft.test.protocol.LocalRaftProtocolFactory in project atomix by atomix.
the class RaftFuzzTest method reset.
/**
* Shuts down clients and servers.
*/
private void reset() throws Exception {
for (Scheduled shutdownTimer : shutdownTimers.values()) {
shutdownTimer.cancel();
}
shutdownTimers.clear();
for (Scheduled restartTimer : restartTimers.values()) {
restartTimer.cancel();
}
restartTimers.clear();
clients.forEach(c -> {
try {
c.close().get(10, TimeUnit.SECONDS);
} catch (Exception e) {
}
});
servers.forEach(s -> {
try {
if (s.isRunning()) {
s.shutdown().get(10, TimeUnit.SECONDS);
}
} catch (Exception e) {
}
});
Path directory = Paths.get("target/fuzz-logs/");
if (Files.exists(directory)) {
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
members = new ArrayList<>();
port = 5000;
clients = new ArrayList<>();
servers = new ArrayList<>();
protocolFactory = new LocalRaftProtocolFactory(PROTOCOL_SERIALIZER);
}
Aggregations