Java Code Examples for org.springframework.boot.context.ApplicationPidFileWriter

The following examples show how to use org.springframework.boot.context.ApplicationPidFileWriter. These examples are extracted from open source projects. 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 Project: WeEvent   Source File: GatewayApplication.java    License: 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 Project: WeEvent   Source File: BrokerApplication.java    License: 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 Project: WeEvent   Source File: ProcessorApplication.java    License: 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 Project: ambari-logsearch   Source File: LogSearch.java    License: 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 Project: ambari-logsearch   Source File: LogFeeder.java    License: 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 Project: seed   Source File: BootRun.java    License: 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
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 Project: para   Source File: ParaServer.java    License: 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 Project: WeEvent   Source File: GovernanceApplication.java    License: 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 Project: redtorch   Source File: ServletInitializer.java    License: 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 Project: piper   Source File: PiperApplication.java    License: 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 Project: tutorials   Source File: Application.java    License: 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();
}