private void connectToChild()

in java/amazon-kinesis-producer/src/main/java/com/amazonaws/services/kinesis/producer/Daemon.java [340:363]


    private void connectToChild() throws IOException {
        long start = System.nanoTime();
        while (true) {
            try {
                inChannel = FileChannel.open(Paths.get(inPipe.getAbsolutePath()), StandardOpenOption.READ);
                outChannel = FileChannel.open(Paths.get(outPipe.getAbsolutePath()), StandardOpenOption.WRITE);
                outStream = Channels.newOutputStream(outChannel);
                break;
            } catch (IOException e) {
                if (inChannel != null && inChannel.isOpen()) {
                    inChannel.close();
                }
                if (outChannel != null && outChannel.isOpen()) {
                    outChannel.close();
                }
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e1) {}
                if (System.nanoTime() - start > 2e9) {
                    throw e;
                }
            }
        }
    }