public class ApplicationPidFileWriter extends ObjectSE implements ApplicationListener<SpringApplicationEvent>, Ordered
ApplicationListener
。このアプリケーションリスナーは、JVM ごとに 1 回だけトリガーされ、ファイル名は、実行時に "PIDFILE" (または "pidfile" )という名前のシステムプロパティまたは環境変数で、または Spring Environment
の spring.pid.file
プロパティを使用してオーバーライドできます。PID ファイルを作成できない場合、例外は報告されません。この動作は、true
を PID_FAIL_ON_WRITE_ERROR
という名前のシステムプロパティまたは環境変数(または "pid_fail_on_write_error" )、または Spring Environment
の spring.pid.fail-on-write-error
プロパティに割り当てることによって変更できます。
メモ: Spring Environment
へのアクセスは、triggerEventType
が ApplicationEnvironmentPreparedEvent
、ApplicationReadyEvent
、ApplicationPreparedEvent
に設定されている場合にのみ可能です。
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
ApplicationPidFileWriter() ファイル名 "application.pid" を使用して、新しい ApplicationPidFileWriter インスタンスを作成します。 |
ApplicationPidFileWriter(FileSE file) 指定されたファイルで新しい ApplicationPidFileWriter インスタンスを作成します。 |
ApplicationPidFileWriter(StringSE filename) 指定したファイル名で新しい ApplicationPidFileWriter インスタンスを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
int | getOrder() |
void | onApplicationEvent(SpringApplicationEvent event) |
protected static void | reset() 作成したフラグをテスト用にリセットします。 |
void | setOrder(int order) |
void | setTriggerEventType(ClassSE<? extends SpringApplicationEvent> triggerEventType) PID ファイルの書き込みをトリガーするアプリケーションイベントの型を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
forPayload
public ApplicationPidFileWriter()
ApplicationPidFileWriter
インスタンスを作成します。public ApplicationPidFileWriter(StringSE filename)
ApplicationPidFileWriter
インスタンスを作成します。filename
- pid を含むファイルの名前 public ApplicationPidFileWriter(FileSE file)
ApplicationPidFileWriter
インスタンスを作成します。file
- pid を含むファイル public void setTriggerEventType(ClassSE<? extends SpringApplicationEvent> triggerEventType)
ApplicationPreparedEvent
です。注: ApplicationStartingEvent
を使用して書き込みをトリガーする場合、Spring Environment
で PID ファイル名を指定することはできません。triggerEventType
- トリガーイベント型 public void onApplicationEvent(SpringApplicationEvent event)
ApplicationListener<SpringApplicationEvent>
の onApplicationEvent
public void setOrder(int order)
protected static void reset()