Example usage for org.springframework.boot.devtools.restart Restarter getInstance

List of usage examples for org.springframework.boot.devtools.restart Restarter getInstance

Introduction

In this page you can find the example usage for org.springframework.boot.devtools.restart Restarter getInstance.

Prototype

public static Restarter getInstance() 

Source Link

Document

Return the active Restarter instance.

Usage

From source file:org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor.java

private boolean isRestarterInitialized() {
    try {/*from  ww  w .  j  a  va  2s . c om*/
        Restarter restarter = Restarter.getInstance();
        return (restarter != null && restarter.getInitialUrls() != null);
    } catch (Exception ex) {
        return false;
    }
}

From source file:org.springframework.boot.devtools.restart.RestartApplicationListener.java

@Override
public void onApplicationEvent(ApplicationEvent event) {
    if (event instanceof ApplicationStartingEvent) {
        onApplicationStartingEvent((ApplicationStartingEvent) event);
    }/* w w w. j  a va2s .c om*/
    if (event instanceof ApplicationPreparedEvent) {
        onApplicationPreparedEvent((ApplicationPreparedEvent) event);
    }
    if (event instanceof ApplicationReadyEvent || event instanceof ApplicationFailedEvent) {
        Restarter.getInstance().finish();
    }
    if (event instanceof ApplicationFailedEvent) {
        onApplicationFailedEvent((ApplicationFailedEvent) event);
    }
}

From source file:org.springframework.boot.devtools.restart.RestartApplicationListener.java

private void onApplicationPreparedEvent(ApplicationPreparedEvent event) {
    Restarter.getInstance().prepare(event.getApplicationContext());
}

From source file:org.springframework.boot.devtools.restart.RestartApplicationListener.java

private void onApplicationFailedEvent(ApplicationFailedEvent event) {
    Restarter.getInstance().remove(event.getApplicationContext());
}

From source file:org.springframework.boot.devtools.restart.server.RestartServer.java

/**
 * Called to restart the application./* w ww  .j a v  a  2s. c om*/
 * @param urls the updated URLs
 * @param files the updated files
 */
protected void restart(Set<URL> urls, ClassLoaderFiles files) {
    Restarter restarter = Restarter.getInstance();
    restarter.addUrls(urls);
    restarter.addClassLoaderFiles(files);
    restarter.restart();
}