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

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

Introduction

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

Prototype

protected Restarter(Thread thread, String[] args, boolean forceReferenceCleanup,
        RestartInitializer initializer) 

Source Link

Document

Internal constructor to create a new Restarter instance.

Usage

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

/**
 * Initialize restart support for the current application. Called automatically by
 * {@link RestartApplicationListener} but can also be called directly if main
 * application arguments are not the same as those passed to the
 * {@link SpringApplication}.//from   w  ww  .  j  a v a  2  s. c o  m
 * @param args main application arguments
 * @param forceReferenceCleanup if forcing of soft/weak reference should happen on
 * each restart. This will slow down restarts and is intended primarily for testing
 * @param initializer the restart initializer
 * @param restartOnInitialize if the restarter should be restarted immediately when
 * the {@link RestartInitializer} returns non {@code null} results
 */
public static void initialize(String[] args, boolean forceReferenceCleanup, RestartInitializer initializer,
        boolean restartOnInitialize) {
    if (instance == null) {
        synchronized (Restarter.class) {
            instance = new Restarter(Thread.currentThread(), args, forceReferenceCleanup, initializer);
        }
        instance.initialize(restartOnInitialize);
    }
}