org.springframework.boot.context.ApplicationPidFileWriter Java Examples

The following examples show how to use org.springframework.boot.context.ApplicationPidFileWriter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GatewayApplication.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    SpringApplication app = new SpringApplication(GatewayApplication.class);
    app.addListeners(new ApplicationPidFileWriter());
    app.run();

    log.info("start gateway success");
}
 
Example #2
Source File: BrokerApplication.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    /* Forbid banner.
    SpringApplicationBuilder builder = new SpringApplicationBuilder(BrokerApplication.class);
    builder.bannerMode(Banner.Mode.OFF).run(args);
    */
    SpringApplication app = new SpringApplication(BrokerApplication.class);
    app.addListeners(new ApplicationPidFileWriter());
    app.run();

    log.info("start broker success");
}
 
Example #3
Source File: ProcessorApplication.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    log.info("start processor success");
    SpringApplication app = new SpringApplication(ProcessorApplication.class);
    app.addListeners(new ApplicationPidFileWriter());
    app.run(args);
    log.info("start processor success");
}
 
Example #4
Source File: LogSearch.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

    String pidFile = System.getenv("LOGSEARCH_PID_FILE") == null ? "logsearch.pid" : System.getenv("LOGSEARCH_PID_FILE");
    new SpringApplicationBuilder(LogSearch.class)
      .bannerMode(Banner.Mode.OFF)
      .listeners(new ApplicationPidFileWriter(pidFile))
      .web(WebApplicationType.SERVLET)
      .run(args);
  }
 
Example #5
Source File: LogFeeder.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  String pidFile = System.getenv("LOGFEEDER_PID_FILE") == null ? "logfeeder.pid" : System.getenv("LOGFEEDER_PID_FILE");
  new SpringApplicationBuilder(LogFeeder.class)
    .bannerMode(Banner.Mode.OFF)
    .listeners(new ApplicationPidFileWriter(pidFile))
    .run(args);
}
 
Example #6
Source File: BootRun.java    From seed with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    //SpringApplication.run(BootRun.class, args);
    //new SpringApplicationBuilder().sources(BootRun.class).profiles(getProfile(new SimpleCommandLinePropertySource(args))).run(args);
    new SpringApplicationBuilder().sources(BootRun.class)
            .listeners(new ApplicationStartingEventListener())
            .listeners(new ApplicationEnvironmentPreparedEventListener())
            .listeners(new ApplicationPreparedEventListener())
            .listeners(new ApplicationFailedEventListener())
            .listeners(new ApplicationPidFileWriter())
            .profiles(getProfile(new SimpleCommandLinePropertySource(args)))
            .run(args);
}
 
Example #7
Source File: Application.java    From spring-boot-quickstart-archtype with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    final SpringApplication springApplication =
        new SpringApplication(Application.class);
    // ir is being added here for LOCAL run ONLY , spring profiles should be be run time parameters when run spring boot jar
    springApplication.setDefaultProperties(Collections.singletonMap("spring.profiles.default","LOCAL"));
    springApplication.addListeners(new ApplicationPidFileWriter());
    springApplication.run(args);
}
 
Example #8
Source File: ParaServer.java    From para with Apache License 2.0 5 votes vote down vote up
/**
 * This is the initializing method when running ParaServer as executable JAR (or WAR),
 * from the command line: java -jar para.jar.
 * @param args command line arguments array (same as those in {@code void main(String[] args)} )
 * @param sources the application classes that will be scanned
 */
public static void runAsJAR(String[] args, Class<?>... sources) {
	// entry point (JAR)
	SpringApplication app = new SpringApplication(sources);
	app.setAdditionalProfiles(Config.ENVIRONMENT);
	app.setWebApplicationType(WebApplicationType.SERVLET);
	app.setBannerMode(Banner.Mode.OFF);
	if (Config.getConfigBoolean("pidfile_enabled", true)) {
		app.addListeners(new ApplicationPidFileWriter(Config.PARA + "_" + getServerPort() + ".pid"));
	}
	initialize(getCoreModules());
	app.run(args);
}
 
Example #9
Source File: GovernanceApplication.java    From WeEvent with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args)  {
    SpringApplication app = new SpringApplication(GovernanceApplication.class);
    app.addListeners(new ApplicationPidFileWriter());
    app.run(args);
    log.info("Start Governance success");
}
 
Example #10
Source File: ServletInitializer.java    From redtorch with MIT License 4 votes vote down vote up
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
	application.listeners(new ApplicationPidFileWriter());
	return application.sources(RtNodeSlaveApplication.class);
}
 
Example #11
Source File: PiperApplication.java    From piper with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
  SpringApplication springApplication = new SpringApplication(PiperApplication.class);
  springApplication.addListeners(new ApplicationPidFileWriter());
  springApplication.run(args);
}
 
Example #12
Source File: Application.java    From tutorials with MIT License 4 votes vote down vote up
private static void writePID() {
    SpringApplicationBuilder app = new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE);
    app.build().addListeners(new ApplicationPidFileWriter("./bin/shutdown.pid"));
    app.run();
}