public class ApplicationPidFileWriter extends Object implements ApplicationListener<SpringApplicationEvent>, Ordered
ApplicationListener that saves application PID into file. This application
listener will be triggered exactly once per JVM, and the file name can be overridden at
runtime with a System property or environment variable named "PIDFILE" (or "pidfile")
or using a spring.pidfile property in the Spring Environment.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
ApplicationPidFileWriter()
Create a new
ApplicationPidFileWriter instance using the filename
'application.pid'. |
ApplicationPidFileWriter(File file)
Create a new
ApplicationPidFileWriter instance with a specified file. |
ApplicationPidFileWriter(String filename)
Create a new
ApplicationPidFileWriter instance with a specified filename. |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
void |
onApplicationEvent(SpringApplicationEvent event) |
void |
setOrder(int order) |
void |
setTriggerEventType(Class<? extends SpringApplicationEvent> triggerEventType)
Sets the type of application event that will trigger writing of the PID file.
|
public ApplicationPidFileWriter()
ApplicationPidFileWriter instance using the filename
'application.pid'.public ApplicationPidFileWriter(String filename)
ApplicationPidFileWriter instance with a specified filename.filename - the name of file containing pidpublic ApplicationPidFileWriter(File file)
ApplicationPidFileWriter instance with a specified file.file - the file containing pidpublic void setTriggerEventType(Class<? extends SpringApplicationEvent> triggerEventType)
ApplicationPreparedEvent. NOTE: If you use the
ApplicationPreparedEvent to trigger the write, you will not be able to
specify the PID filename in the Spring Environment.triggerEventType - the event trigger typepublic void onApplicationEvent(SpringApplicationEvent event)
onApplicationEvent in interface ApplicationListener<SpringApplicationEvent>public void setOrder(int order)
Copyright © 2015 Pivotal Software, Inc.. All rights reserved.