Search in sources :

Example 1 with Consumer

use of com.ibm.streamsx.topology.function.Consumer in project streamsx.topology by IBMStreams.

the class FileStreamsTest method createFiles.

@SuppressWarnings("serial")
static Consumer<Long> createFiles(final String[] files, final int repeat) {
    return new Consumer<Long>() {

        @Override
        public void accept(Long arg0) {
            try {
                for (int r = 0; r < repeat; r++) {
                    for (int i = 0; i < files.length; i++) {
                        Path path = Paths.get(files[i]);
                        if (repeat > 1) {
                            path.toFile().delete();
                            Thread.sleep(10);
                        }
                        Files.createFile(path);
                        Thread.sleep(10);
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    };
}
Also used : Path(java.nio.file.Path) Consumer(com.ibm.streamsx.topology.function.Consumer)

Aggregations

Consumer (com.ibm.streamsx.topology.function.Consumer)1 Path (java.nio.file.Path)1