@Override public void start() { if (this.tailAdapter != null) { this.tailAdapter.start(); } }
@Override public void stop() { if (this.tailAdapter != null) { this.tailAdapter.stop(); } }
adapter.setFile(this.file); if (this.taskExecutor != null) { adapter.setTaskExecutor(this.taskExecutor); adapter.setTaskScheduler(this.taskScheduler); adapter.setTailAttemptsDelay(this.fileDelay); adapter.setIdleEventInterval(this.idleEventInterval); adapter.setOutputChannel(this.outputChannel); adapter.setErrorChannel(this.errorChannel); adapter.setBeanName(this.beanName); if (this.autoStartup != null) { adapter.setAutoStartup(this.autoStartup); adapter.setPhase(this.phase); adapter.setApplicationEventPublisher(this.applicationEventPublisher); adapter.setBeanFactory(getBeanFactory()); // NOSONAR never null adapter.afterPropertiesSet(); this.tailAdapter = adapter; return adapter;
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.afterPropertiesSet(); adapter.setTaskScheduler(taskScheduler); final List<FileTailingEvent> events = new ArrayList<FileTailingEvent>(); adapter.setApplicationEventPublisher(event -> { FileTailingEvent tailEvent = (FileTailingEvent) event; logger.debug(event); events.add(tailEvent); }); adapter.setFile(new File(testDir, "foo")); QueueChannel outputChannel = new QueueChannel(); adapter.setOutputChannel(outputChannel); adapter.setTailAttemptsDelay(500); adapter.setBeanFactory(mock(BeanFactory.class)); adapter.afterPropertiesSet(); File file = new File(testDir, "foo"); File renamed = new File(testDir, "bar"); file.delete(); renamed.delete(); adapter.start(); waitForField(adapter, field); FileOutputStream foo = new FileOutputStream(file);
@Override protected FileTailingMessageProducerSupport doGet() { if (this.outputChannel == null) { this.factoryBean.setOutputChannel(new NullChannel()); } FileTailingMessageProducerSupport tailingMessageProducerSupport = null; try { this.factoryBean.afterPropertiesSet(); tailingMessageProducerSupport = this.factoryBean.getObject(); } catch (Exception e) { throw new IllegalStateException(e); } if (this.errorChannel != null) { tailingMessageProducerSupport.setErrorChannel(this.errorChannel); } tailingMessageProducerSupport.setOutputChannel(this.outputChannel); return tailingMessageProducerSupport; }
@Override protected FileTailingMessageProducerSupport doGet() { if (this.outputChannel == null) { this.factoryBean.setOutputChannel(new NullChannel()); } FileTailingMessageProducerSupport tailingMessageProducerSupport = null; try { this.factoryBean.afterPropertiesSet(); tailingMessageProducerSupport = this.factoryBean.getObject(); } catch (Exception e) { throw new IllegalStateException(e); } if (this.errorChannel != null) { tailingMessageProducerSupport.setErrorChannel(this.errorChannel); } tailingMessageProducerSupport.setOutputChannel(this.outputChannel); return tailingMessageProducerSupport; }
@Override protected FileTailingMessageProducerSupport doGet() { if (this.outputChannel == null) { this.factoryBean.setOutputChannel(new NullChannel()); } FileTailingMessageProducerSupport tailingMessageProducerSupport = null; try { this.factoryBean.afterPropertiesSet(); tailingMessageProducerSupport = this.factoryBean.getObject(); } catch (Exception e) { throw new IllegalStateException(e); } if (this.errorChannel != null) { tailingMessageProducerSupport.setErrorChannel(this.errorChannel); } tailingMessageProducerSupport.setOutputChannel(this.outputChannel); return tailingMessageProducerSupport; }
@Override public void stop(Runnable callback) { if (this.tailAdapter != null) { this.tailAdapter.stop(callback); } else { callback.run(); } }
@After public void tearDown() { if (this.adapter != null) { adapter.stop(); } }