@Override protected void doStop() { super.doStop(); destroyProcess(); }
@Override public void start() { if (this.tailAdapter != null) { this.tailAdapter.start(); } }
@Override public String toString() { return super.toString() + " [idle time=" + this.idleTime + "]"; }
@Test @TailAvailable public void testOS() throws Exception { OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES); testGuts(adapter, "stdOutReader"); }
@Test public void testApache() throws Exception { ApacheCommonsFileTailingMessageProducer adapter = new ApacheCommonsFileTailingMessageProducer(); adapter.setPollingDelay(100); adapter.setEnd(false); testGuts(adapter, "tailer"); }
@Override protected void doStart() { super.doStart(); destroyProcess(); this.command = "tail " + this.options + " " + this.getFile().getAbsolutePath(); this.getTaskExecutor().execute(this::runExec); }
@Override protected void doStart() { super.doStart(); Tailer theTailer = new Tailer(this.getFile(), this, this.pollingDelay, this.end, this.reopen); this.getTaskExecutor().execute(theTailer); this.tailer = theTailer; }
@Override public void stop() { if (this.tailAdapter != null) { this.tailAdapter.stop(); } }
private void publishIdleEvent(long idleTime) { if (this.eventPublisher != null) { if (getFile().exists()) { FileTailingIdleEvent event = new FileTailingIdleEvent(this, this.file, idleTime); this.eventPublisher.publishEvent(event); } } else { logger.info("No publisher for idle event"); } }
@Override public String getComponentType() { return super.getComponentType() + " (Apache)"; }
@Override public int getPhase() { if (this.tailAdapter != null) { return this.tailAdapter.getPhase(); } return 0; }
@Override public boolean isRunning() { return this.tailAdapter != null && this.tailAdapter.isRunning(); }
@Override public void handle(String line) { send(line); }
@Override public boolean isAutoStartup() { return this.tailAdapter != null && this.tailAdapter.isAutoStartup(); }
@Override public void handle(Exception ex) { this.publish(ex.getMessage()); }
@Override protected void doStop() { super.doStop(); this.tailer.stop(); }
@Override public void stop(Runnable callback) { if (this.tailAdapter != null) { this.tailAdapter.stop(callback); } else { callback.run(); } }
@Override public String getComponentType() { return super.getComponentType() + " (native)"; }
@After public void tearDown() { if (this.adapter != null) { adapter.stop(); } }