@Test public void testStopWithNoFileUsingExecutor() throws Exception { final File file = new File(getTestDirectory(),"nosuchfile"); assertFalse("nosuchfile should not exist", file.exists()); final TestTailerListener listener = new TestTailerListener(); final int delay = 100; final int idle = 50; tailer = new Tailer(file, listener, delay, false); final Executor exec = new ScheduledThreadPoolExecutor(1); exec.execute(tailer); TestUtils.sleep(idle); tailer.stop(); tailer=null; TestUtils.sleep(delay+idle); assertNull("Should not generate Exception", listener.exception); assertEquals("Expected init to be called", 1 , listener.initialised); assertTrue("fileNotFound should be called", listener.notFound > 0); assertEquals("fileRotated should be not be called", 0 , listener.rotated); assertEquals("end of file never reached", 0, listener.reachedEndOfFile); }
private void stop(final Exception e) { listener.handle(e); stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen,
            final int bufSize); static Tailer create(final File file, final Charset charset, final TailerListener listener,
                                final long delayMillis, final boolean end, final boolean reOpen
            ,final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen); static Tailer create(final File file, final TailerListener listener, final long delayMillis); static Tailer create(final File file, final TailerListener listener); File getFile(); long getDelay(); void run(); void stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen,
            final int bufSize); static Tailer create(final File file, final Charset charset, final TailerListener listener,
                                final long delayMillis, final boolean end, final boolean reOpen
            ,final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen); static Tailer create(final File file, final TailerListener listener, final long delayMillis); static Tailer create(final File file, final TailerListener listener); File getFile(); long getDelay(); void run(); void stop();  }