in java/amazon-kinesis-producer/src/main/java/com/amazonaws/services/kinesis/producer/Daemon.java [386:419]
private void createPipesUnix() {
File dir = new File(this.workingDir);
if (!dir.exists()) {
dir.mkdirs();
}
do {
inPipe = Paths.get(dir.getAbsolutePath(),
"amz-aws-kpl-in-pipe-" + uuid8Chars()).toFile();
} while (inPipe.exists());
do {
outPipe = Paths.get(dir.getAbsolutePath(),
"amz-aws-kpl-out-pipe-" + uuid8Chars()).toFile();
} while (outPipe.exists());
try {
Runtime.getRuntime().exec("mkfifo " + inPipe.getAbsolutePath() + " " + outPipe.getAbsolutePath());
} catch (Exception e) {
fatalError("Error creating pipes", e, false);
}
// The files apparently don't always show up immediately after the exec,
// so we make sure they are there before proceeding
long start = System.nanoTime();
while (!inPipe.exists() || !outPipe.exists()) {
try {
Thread.sleep(10);
} catch (InterruptedException e) { }
if (System.nanoTime() - start > 15e9) {
fatalError("Pipes did not show up after calling mkfifo", false);
}
}
}