Java 类org.springframework.boot.devtools.filewatch.FileSystemWatcher 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:FileWatchingFailureHandler.java   
@Override
public Outcome handle(Throwable failure) {
    CountDownLatch latch = new CountDownLatch(1);
    FileSystemWatcher watcher = this.fileSystemWatcherFactory.getFileSystemWatcher();
    watcher.addSourceFolders(
            new ClassPathFolders(Restarter.getInstance().getInitialUrls()));
    watcher.addListener(new Listener(latch));
    watcher.start();
    try {
        latch.await();
    }
    catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
    }
    return Outcome.RETRY;
}
项目:spring-boot-concourse    文件:FileWatchingFailureHandler.java   
@Override
public Outcome handle(Throwable failure) {
    CountDownLatch latch = new CountDownLatch(1);
    FileSystemWatcher watcher = this.fileSystemWatcherFactory.getFileSystemWatcher();
    watcher.addSourceFolders(
            new ClassPathFolders(Restarter.getInstance().getInitialUrls()));
    watcher.addListener(new Listener(latch));
    watcher.start();
    try {
        latch.await();
    }
    catch (InterruptedException ex) {
        // Ignore
    }
    return Outcome.RETRY;
}
项目:contestparser    文件:FileWatchingFailureHandler.java   
@Override
public Outcome handle(Throwable failure) {
    failure.printStackTrace();
    CountDownLatch latch = new CountDownLatch(1);
    FileSystemWatcher watcher = this.fileSystemWatcherFactory.getFileSystemWatcher();
    watcher.addSourceFolders(
            new ClassPathFolders(Restarter.getInstance().getInitialUrls()));
    watcher.addListener(new Listener(latch));
    watcher.start();
    try {
        latch.await();
    }
    catch (InterruptedException ex) {
        // Ignore
    }
    return Outcome.RETRY;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:LocalDevToolsAutoConfiguration.java   
@Bean
public FileSystemWatcherFactory fileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:LocalDevToolsAutoConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    List<File> additionalPaths = restartProperties.getAdditionalPaths();
    for (File path : additionalPaths) {
        watcher.addSourceFolder(path.getAbsoluteFile());
    }
    return watcher;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteClientConfiguration.java   
@Bean
public FileSystemWatcherFactory getFileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteClientConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    return watcher;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ClassPathFileSystemWatcher.java   
@Override
public void afterPropertiesSet() throws Exception {
    if (this.restartStrategy != null) {
        FileSystemWatcher watcherToStop = null;
        if (this.stopWatcherOnRestart) {
            watcherToStop = this.fileSystemWatcher;
        }
        this.fileSystemWatcher.addListener(new ClassPathFileChangeListener(
                this.applicationContext, this.restartStrategy, watcherToStop));
    }
    this.fileSystemWatcher.start();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ClassPathFileChangeListener.java   
/**
 * Create a new {@link ClassPathFileChangeListener} instance.
 * @param eventPublisher the event publisher used send events
 * @param restartStrategy the restart strategy to use
 * @param fileSystemWatcherToStop the file system watcher to stop on a restart (or
 * {@code null})
 */
ClassPathFileChangeListener(ApplicationEventPublisher eventPublisher,
        ClassPathRestartStrategy restartStrategy,
        FileSystemWatcher fileSystemWatcherToStop) {
    Assert.notNull(eventPublisher, "EventPublisher must not be null");
    Assert.notNull(restartStrategy, "RestartStrategy must not be null");
    this.eventPublisher = eventPublisher;
    this.restartStrategy = restartStrategy;
    this.fileSystemWatcherToStop = fileSystemWatcherToStop;
}
项目:spring-boot-concourse    文件:LocalDevToolsAutoConfiguration.java   
@Bean
public FileSystemWatcherFactory fileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:spring-boot-concourse    文件:LocalDevToolsAutoConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    List<File> additionalPaths = restartProperties.getAdditionalPaths();
    for (File path : additionalPaths) {
        watcher.addSourceFolder(path.getAbsoluteFile());
    }
    return watcher;
}
项目:spring-boot-concourse    文件:RemoteClientConfiguration.java   
@Bean
public FileSystemWatcherFactory getFileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:spring-boot-concourse    文件:RemoteClientConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    return watcher;
}
项目:spring-boot-concourse    文件:ClassPathFileSystemWatcher.java   
@Override
public void afterPropertiesSet() throws Exception {
    if (this.restartStrategy != null) {
        FileSystemWatcher watcherToStop = null;
        if (this.stopWatcherOnRestart) {
            watcherToStop = this.fileSystemWatcher;
        }
        this.fileSystemWatcher.addListener(new ClassPathFileChangeListener(
                this.applicationContext, this.restartStrategy, watcherToStop));
    }
    this.fileSystemWatcher.start();
}
项目:spring-boot-concourse    文件:ClassPathFileChangeListener.java   
/**
 * Create a new {@link ClassPathFileChangeListener} instance.
 * @param eventPublisher the event publisher used send events
 * @param restartStrategy the restart strategy to use
 * @param fileSystemWatcherToStop the file system watcher to stop on a restart (or
 * {@code null})
 */
ClassPathFileChangeListener(ApplicationEventPublisher eventPublisher,
        ClassPathRestartStrategy restartStrategy,
        FileSystemWatcher fileSystemWatcherToStop) {
    Assert.notNull(eventPublisher, "EventPublisher must not be null");
    Assert.notNull(restartStrategy, "RestartStrategy must not be null");
    this.eventPublisher = eventPublisher;
    this.restartStrategy = restartStrategy;
    this.fileSystemWatcherToStop = fileSystemWatcherToStop;
}
项目:contestparser    文件:LocalDevToolsAutoConfiguration.java   
@Bean
public FileSystemWatcherFactory fileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:contestparser    文件:LocalDevToolsAutoConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    List<File> additionalPaths = restartProperties.getAdditionalPaths();
    for (File path : additionalPaths) {
        watcher.addSourceFolder(path.getAbsoluteFile());
    }
    return watcher;
}
项目:contestparser    文件:RemoteClientConfiguration.java   
@Bean
public FileSystemWatcherFactory getFileSystemWatcherFactory() {
    return new FileSystemWatcherFactory() {

        @Override
        public FileSystemWatcher getFileSystemWatcher() {
            return newFileSystemWatcher();
        }

    };
}
项目:contestparser    文件:RemoteClientConfiguration.java   
private FileSystemWatcher newFileSystemWatcher() {
    Restart restartProperties = this.properties.getRestart();
    FileSystemWatcher watcher = new FileSystemWatcher(true,
            restartProperties.getPollInterval(),
            restartProperties.getQuietPeriod());
    String triggerFile = restartProperties.getTriggerFile();
    if (StringUtils.hasLength(triggerFile)) {
        watcher.setTriggerFilter(new TriggerFileFilter(triggerFile));
    }
    return watcher;
}
项目:contestparser    文件:ClassPathFileSystemWatcher.java   
@Override
public void afterPropertiesSet() throws Exception {
    if (this.restartStrategy != null) {
        FileSystemWatcher watcherToStop = null;
        if (this.stopWatcherOnRestart) {
            watcherToStop = this.fileSystemWatcher;
        }
        this.fileSystemWatcher.addListener(new ClassPathFileChangeListener(
                this.applicationContext, this.restartStrategy, watcherToStop));
    }
    this.fileSystemWatcher.start();
}
项目:contestparser    文件:ClassPathFileChangeListener.java   
/**
 * Create a new {@link ClassPathFileChangeListener} instance.
 * @param eventPublisher the event publisher used send events
 * @param restartStrategy the restart strategy to use
 * @param fileSystemWatcherToStop the file system watcher to stop on a restart (or
 * {@code null})
 */
ClassPathFileChangeListener(ApplicationEventPublisher eventPublisher,
        ClassPathRestartStrategy restartStrategy,
        FileSystemWatcher fileSystemWatcherToStop) {
    Assert.notNull(eventPublisher, "EventPublisher must not be null");
    Assert.notNull(restartStrategy, "RestartStrategy must not be null");
    this.eventPublisher = eventPublisher;
    this.restartStrategy = restartStrategy;
    this.fileSystemWatcherToStop = fileSystemWatcherToStop;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ClassPathFileSystemWatcherTests.java   
MockFileSystemWatcherFactory(FileSystemWatcher watcher) {
    this.watcher = watcher;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ClassPathFileSystemWatcherTests.java   
@Override
public FileSystemWatcher getFileSystemWatcher() {
    return this.watcher;
}
项目:spring-boot-concourse    文件:ClassPathFileSystemWatcherTests.java   
MockFileSystemWatcherFactory(FileSystemWatcher watcher) {
    this.watcher = watcher;
}
项目:spring-boot-concourse    文件:ClassPathFileSystemWatcherTests.java   
@Override
public FileSystemWatcher getFileSystemWatcher() {
    return this.watcher;
}
项目:contestparser    文件:ClassPathFileSystemWatcherTests.java   
MockFileSystemWatcherFactory(FileSystemWatcher watcher) {
    this.watcher = watcher;
}
项目:contestparser    文件:ClassPathFileSystemWatcherTests.java   
@Override
public FileSystemWatcher getFileSystemWatcher() {
    return this.watcher;
}