@Test public void testTwoTails() throws Exception { ReadTail tail1 = new ReadTail(); TailSchedule schedule1 = TailSchedule.builder(tail1) .delay(500, TimeUnit.MILLISECONDS) .build(); logBuffer.forwardWithFixedDelay(schedule1); ReadTail tail2 = new ReadTail(); TailSchedule schedule2 = TailSchedule.builder(tail2) .delay(500, TimeUnit.MILLISECONDS) .build(); logBuffer.forwardWithFixedDelay(schedule2); List<Log> written = LogUtil.writeList(logBuffer, 10, 3000); long now = System.currentTimeMillis(); while (System.currentTimeMillis() < now + 5000) { if (tail1.reads.size() + tail2.reads.size() == written.size()) { return; } Thread.sleep(100); } fail(tail1.reads.size() + tail2.reads.size() + " != " + written.size()); }
public void forwardWithFixedDelay(TailSchedule schedule) throws IOException { LogBufferTail logBufferTail = putIfAbsent(schedule); logBufferTail.forwardWithFixedDelay(schedule.getDelay(), schedule.getUnit()); }
LogBuffer { public void forwardWithFixedDelay(TailSchedule schedule) throws IOException { LogBufferTail logBufferTail = putIfAbsent(schedule); logBufferTail.forwardWithFixedDelay(schedule.getDelay(), schedule.getUnit()); } }
LogBuffer { public void forwardWithFixedDelay(TailSchedule schedule) throws IOException { LogBufferTail logBufferTail = putIfAbsent(schedule); logBufferTail.forwardWithFixedDelay(schedule.getDelay(), schedule.getUnit()); } protected  LogBuffer(Builder builder); }
LogBuffer { public void forwardWithFixedDelay(TailSchedule schedule) throws IOException { LogBufferTail logBufferTail = putIfAbsent(schedule); logBufferTail.forwardWithFixedDelay(schedule.getDelay(), schedule.getUnit()); } 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 void forwardWithFixedDelay(TailSchedule schedule) throws IOException { LogBufferTail logBufferTail = putIfAbsent(schedule); logBufferTail.forwardWithFixedDelay(schedule.getDelay(), schedule.getUnit()); } 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);  }