in harness/src/main/java/org/apache/geode/perftest/infrastructure/ssh/SshInfrastructure.java [149:181]
public void copyToNodes(Iterable<File> files, Function<Node, String> destDirFunction,
boolean removeExisting)
throws IOException {
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (Node node : this.getNodes()) {
futures.add(CompletableFuture.runAsync(() -> {
InetAddress address = node.getAddress();
String destDir = destDirFunction.apply(node);
try (SSHClient client = getSSHClient(address)) {
client.useCompression();
if (removeExisting) {
try (Session session = client.startSession()) {
session.exec(String.format("rm -rf '%s'", destDir)).join();
}
}
try (Session session = client.startSession()) {
session.exec(String.format("mkdir -p '%s'", destDir)).join();
}
for (File file : files) {
logger.debug("Copying " + file + " to " + address);
client.newSCPFileTransfer().upload(new FileSystemFile(file), destDir);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}));
}
futures.forEach(CompletableFuture::join);
}