@Test public void testParallel() throws Exception { Log[] written = LogUtil.writeList(logBuffer, 1, 5000).toArray(new Log[0]); Log[] logs = logBuffer.parallel().stream() .sorted().collect(Collectors.toList()).toArray(new Log[0]); assertArrayEquals(logs, written); }
public Logs parallel() { Collection<Dir> dirs = initalizeDirs(); Stream<Log> result = null; for (Dir d : dirs) { Stream<Log> stream = Guavas.toStream(new Dirs.LogIterator(d), true); if (result == null) { result = stream; } else { result = Stream.concat(stream, result); } } if (result == null) { return new Logs(Stream.empty()); } return new Logs(result); }
LogBuffer { public Logs parallel() { Collection<Dir> dirs = initalizeDirs(); Stream<Log> result = null; for (Dir d : dirs) { Stream<Log> stream = Guavas.toStream(new Dirs.LogIterator(d), true); if (result == null) { result = stream; } else { result = Stream.concat(stream, result); } } if (result == null) { return new Logs(Stream.empty()); } return new Logs(result); } }
LogBuffer { public Logs parallel() { Collection<Dir> dirs = initalizeDirs(); Stream<Log> result = null; for (Dir d : dirs) { Stream<Log> stream = Guavas.toStream(new Dirs.LogIterator(d), true); if (result == null) { result = stream; } else { result = Stream.concat(stream, result); } } if (result == null) { return new Logs(Stream.empty()); } return new Logs(result); } protected  LogBuffer(Builder builder); }
LogBuffer { public Logs parallel() { Collection<Dir> dirs = initalizeDirs(); Stream<Log> result = null; for (Dir d : dirs) { Stream<Log> stream = Guavas.toStream(new Dirs.LogIterator(d), true); if (result == null) { result = stream; } else { result = Stream.concat(stream, result); } } if (result == null) { return new Logs(Stream.empty()); } return new Logs(result); } protected  LogBuffer(Builder builder); static Builder newBuilder(); Log write(byte[] content); Log write(Encodable encodable); Log write(String content); Optional<Log> getIndex(long index); Logs find(Query query); Logs parallel(); TailForwardResult forward(TailSchedule schedule); Long setReadTime(TailSchedule schedule, long startTime); File getBasePath(); synchronized void close(); long getWriteIndex(); void cancel(Class<? extends Tail> cls); void cancel(Class<? extends Tail> cls, boolean mayInterruptIfRunning); void forwardWithFixedDelay(TailSchedule schedule); }
LogBuffer { public Logs parallel() { Collection<Dir> dirs = initalizeDirs(); Stream<Log> result = null; for (Dir d : dirs) { Stream<Log> stream = Guavas.toStream(new Dirs.LogIterator(d), true); if (result == null) { result = stream; } else { result = Stream.concat(stream, result); } } if (result == null) { return new Logs(Stream.empty()); } return new Logs(result); } protected  LogBuffer(Builder builder); static Builder newBuilder(); Log write(byte[] content); Log write(Encodable encodable); Log write(String content); Optional<Log> getIndex(long index); Logs find(Query query); Logs parallel(); TailForwardResult forward(TailSchedule schedule); Long setReadTime(TailSchedule schedule, long startTime); File getBasePath(); synchronized void close(); long getWriteIndex(); void cancel(Class<? extends Tail> cls); void cancel(Class<? extends Tail> cls, boolean mayInterruptIfRunning); void forwardWithFixedDelay(TailSchedule schedule);  }