use of org.springframework.boot.context.ApplicationPidFileWriter in project testsigma by testsigmahq.
the class TestsigmaWebApplication method main.
public static void main(String[] args) {
try {
System.setProperty("com.sun.security.enableAIAcaIssuers", "true");
SpringApplication application = new SpringApplication(TestsigmaWebApplication.class);
application.addListeners(new ApplicationPidFileWriter("./bin/app.pid"));
application.run();
} catch (Throwable t) {
t.printStackTrace();
}
}
use of org.springframework.boot.context.ApplicationPidFileWriter in project ontrack by nemerosa.
the class Application method main.
/**
* Start-up point
*
* @param args Arguments passed to the program, they may contain configuration variables.
*/
public static void main(String[] args) {
// PID file
File pid = new File("ontrack.pid");
// Runs the application
SpringApplication application = new SpringApplication(Application.class);
application.addListeners(new ApplicationPidFileWriter(pid));
application.run(args);
}
use of org.springframework.boot.context.ApplicationPidFileWriter in project openpos-framework by JumpMind.
the class OpenposManagementServer method main.
public static void main(String[] args) throws Exception {
System.out.println("OpenposManagementServer working dir: " + System.getProperty("user.dir"));
invokeOptionalStartupClass();
SpringApplication application = new SpringApplication(OpenposManagementServer.class);
application.addListeners(new ApplicationPidFileWriter());
application.run(args);
}
use of org.springframework.boot.context.ApplicationPidFileWriter in project SpringBootSample by heowc.
the class SpringBootGracefulShutdownApplication method main.
public static void main(String[] args) {
SpringApplication application = new SpringApplicationBuilder().sources(SpringBootGracefulShutdownApplication.class).listeners(new ApplicationPidFileWriter("./application.pid")).build();
application.run(args);
}
use of org.springframework.boot.context.ApplicationPidFileWriter in project modeldb by VertaAI.
the class ServiceSet method startSpringServer.
private static void startSpringServer() {
var path = System.getProperty(CommonConstants.USER_DIR) + "/" + ModelDBConstants.BACKEND_PID;
try {
File pidFile = new File(path);
if (pidFile.exists()) {
try (BufferedReader reader = new BufferedReader(new FileReader(pidFile))) {
String pidString = reader.readLine();
var pid = Long.parseLong(pidString);
var process = ProcessHandle.of(pid);
if (process.isPresent()) {
var processHandle = process.get();
LOGGER.warn("Port is already used by modeldb_backend PID: {}", pid);
boolean destroyed = processHandle.destroy();
LOGGER.warn("Process kill completed `{}` for PID: {}", destroyed, pid);
processHandle = processHandle.onExit().get();
LOGGER.warn("Process is alive after kill: `{}`", processHandle.isAlive());
}
}
}
SpringApplication application = new SpringApplication(App.class);
application.addListeners(new ApplicationPidFileWriter(path));
application.run();
} catch (Exception e) {
throw new ModelDBException(e);
}
}
Aggregations