public static enum Worker.State extends Enum<Worker.State>
Workerの状態。Workerでの状態遷移は明確に定義されています。すべてのWorkerはREADY状態で開始されます。状況によっては、Workerは実際に実行される前に、その実行がスケジュールされる場合があります。そのような場合、WorkerがいつRUNNINGであるかとは別に、いつSCHEDULEDであるかを知ることが有用なことがあります。ただし、Workerが即時に実行される場合でも、WorkerはRUNNING状態になる前に一時的にSCHEDULED状態になります。つまり、遷移は常にREADYからSCHEDULEDへ、そこからRUNNINGへとなります(Workerが取り消される場合以外)。
実行され、取り消されないWorkerは、SUCCEEDEDまたはFAILEDという2つの状態のいずれかになります。Workerの実行中に例外がスローされた場合にのみ、FAILEDになります。WorkerはREADY、SCHEDULEDまたはRUNNINGのときに取り消される場合があり、その場合の最終ステータスはCANCELLEDになります。これらの状況のいずれかで取り消されると、Workerは即時にCANCELLED状態に移行します。
再利用可能なWorkerは、CANCELLED、SUCCEEDEDまたはFAILEDからREADYに戻ります。その時点から、再度、通常の状態遷移に従います。
列挙型定数と説明 |
---|
CANCELLED
このWorkerが
Worker.cancel() メソッドによって取り消されたことを示します。 |
FAILED
通常は予期しない条件が発生したことによって、このWorkerが失敗したことを示します。
|
READY
Workerがまだ実行されておらず、実行の準備ができているか、またはWorkerが再初期化されたことを示します。
|
RUNNING
このWorkerが実行中であることを示します。
|
SCHEDULED
Workerの実行がスケジュールされているが、現在は実行中ではないことを示します。
|
SUCCEEDED
このWorkerが正常に完了しており、
value プロパティから読み取る準備ができている有効な結果があることを示します。 |
修飾子と型 | メソッドと説明 |
---|---|
static Worker.State |
valueOf(String name)
指定された名前を持つ、この型の列挙型定数を返します。
|
static Worker.State[] |
values()
この列挙型の定数を含む配列を、宣言されている順序で返します。
|
public static final Worker.State READY
public static final Worker.State SCHEDULED
public static final Worker.State RUNNING
public static final Worker.State SUCCEEDED
value
プロパティから読み取る準備ができている有効な結果があることを示します。public static final Worker.State CANCELLED
Worker.cancel()
メソッドによって取り消されたことを示します。public static final Worker.State FAILED
exception
プロパティから取得できます。public static Worker.State[] values()
for (Worker.State c : Worker.State.values()) System.out.println(c);
public static Worker.State valueOf(String name)
name
- 返される列挙型定数の名前。IllegalArgumentException
- 指定された名前を持つ定数をこの列挙型が持っていない場合NullPointerException
- 引数がnullの場合Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.