public class ApplicationPidFileWriter extends ObjectSE implements org.springframework.context.ApplicationListener<SpringApplicationEvent>, org.springframework.core.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
に設定されている場合にのみ可能です。
コンストラクターと説明 |
---|
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
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)
org.springframework.context.ApplicationListener<SpringApplicationEvent>
の onApplicationEvent
public void setOrder(int order)
public int getOrder()
org.springframework.core.Ordered
の getOrder
protected static void reset()
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.