クラス ApplicationPidFileWriter
java.lang.ObjectSE
org.springframework.boot.context.ApplicationPidFileWriter
- 実装されたすべてのインターフェース:
EventListenerSE
、ApplicationListener<SpringApplicationEvent>
、Ordered
public class ApplicationPidFileWriter
extends ObjectSE
implements ApplicationListener<SpringApplicationEvent>, Ordered
アプリケーションの PID をファイルに保存する
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
に設定されている場合にのみ可能です。
- 導入:
- 2.0.0
- 作成者:
- Jakub Kubrynski, Dave Syer, Phillip Webb, Tomasz Przybyla, Madhura Bhave
フィールドサマリー
インターフェース org.springframework.core.Ordered から継承されたフィールド
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターのサマリー
コンストラクター説明ファイル名 "application.pid" を使用して、新しいApplicationPidFileWriter
インスタンスを作成します。指定されたファイルで新しいApplicationPidFileWriter
インスタンスを作成します。ApplicationPidFileWriter
(StringSE filename) 指定したファイル名で新しいApplicationPidFileWriter
インスタンスを作成します。方法の概要
修飾子と型メソッド説明int
getOrder()
void
protected static void
reset()
作成したフラグをテスト用にリセットします。void
setOrder
(int order) void
setTriggerEventType
(ClassSE<? extends SpringApplicationEvent> triggerEventType) PID ファイルの書き込みをトリガーするアプリケーションイベントの型を設定します。クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSE
インターフェース org.springframework.context.ApplicationListener から継承されたメソッド
supportsAsyncExecution
コンストラクターの詳細
ApplicationPidFileWriter
public ApplicationPidFileWriter()ファイル名 "application.pid" を使用して、新しいApplicationPidFileWriter
インスタンスを作成します。ApplicationPidFileWriter
指定したファイル名で新しいApplicationPidFileWriter
インスタンスを作成します。- パラメーター:
filename
- pid を含むファイルの名前
ApplicationPidFileWriter
指定されたファイルで新しいApplicationPidFileWriter
インスタンスを作成します。- パラメーター:
file
- pid を含むファイル
メソッドの詳細
setTriggerEventType
PID ファイルの書き込みをトリガーするアプリケーションイベントの型を設定します。デフォルトはApplicationPreparedEvent
です。注:ApplicationStartingEvent
を使用して書き込みをトリガーする場合、SpringEnvironment
で PID ファイル名を指定することはできません。- パラメーター:
triggerEventType
- トリガーイベント型
onApplicationEvent
- 次で指定:
- インターフェース
ApplicationListener<SpringApplicationEvent>
のonApplicationEvent
setOrder
public void setOrder(int order) getOrder
public int getOrder()reset
protected static void reset()作成したフラグをテスト用にリセットします。