ApplicationPidFileWriter

An 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.pid.file property in the Spring Environment.

If PID file can not be created no exception is reported. This behavior can be changed by assigning true to System property or environment variable named PID_FAIL_ON_WRITE_ERROR (or "pid_fail_on_write_error") or to spring.pid.fail-on-write-error property in the Spring Environment.

Note: access to the Spring Environment is only possible when the triggerEventType is set to ApplicationEnvironmentPreparedEvent, ApplicationReadyEvent, or ApplicationPreparedEvent.

Author

Jakub Kubrynski

Dave Syer

Phillip Webb

Tomasz Przybyla

Madhura Bhave

Since

2.0.0

Constructors

Link copied to clipboard
constructor()
Create a new ApplicationPidFileWriter instance using the filename 'application.pid'.
constructor(filename: String)
Create a new ApplicationPidFileWriter instance with a specified filename.
constructor(file: File)
Create a new ApplicationPidFileWriter instance with a specified file.

Properties

Link copied to clipboard
val HIGHEST_PRECEDENCE: Int = -2147483648
Link copied to clipboard
val LOWEST_PRECEDENCE: Int = 2147483647
Link copied to clipboard
open var order: Int

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun getOrder(): Int
Link copied to clipboard
Link copied to clipboard
open fun setTriggerEventType(triggerEventType: Class<out SpringApplicationEvent>)
Sets the type of application event that will trigger writing of the PID file.
Link copied to clipboard