50 |
|
* During setCompletion, state may take on transient values of |
51 |
|
* COMPLETING (while outcome is being set) or INTERRUPTING (only |
52 |
|
* while interrupting the runner to satisfy a cancel(true)). |
53 |
< |
* State values are ordered and set to powers of two to simplify |
54 |
< |
* checks. |
53 |
> |
* State values are highly order-dependent to simplify checks. |
54 |
|
* |
55 |
|
* Possible state transitions: |
56 |
|
* UNDECIDED -> COMPLETING -> NORMAL |
59 |
|
* UNDECIDED -> INTERRUPTING -> INTERRUPTED |
60 |
|
*/ |
61 |
|
private volatile int state; |
62 |
< |
private static final int UNDECIDED = 0x00; |
63 |
< |
private static final int COMPLETING = 0x01; |
64 |
< |
private static final int NORMAL = 0x02; |
65 |
< |
private static final int EXCEPTIONAL = 0x04; |
66 |
< |
private static final int CANCELLED = 0x08; |
67 |
< |
private static final int INTERRUPTING = 0x10; |
68 |
< |
private static final int INTERRUPTED = 0x20; |
62 |
> |
private static final int UNDECIDED = 0; |
63 |
> |
private static final int COMPLETING = 1; |
64 |
> |
private static final int NORMAL = 2; |
65 |
> |
private static final int EXCEPTIONAL = 3; |
66 |
> |
private static final int CANCELLED = 4; |
67 |
> |
private static final int INTERRUPTING = 5; |
68 |
> |
private static final int INTERRUPTED = 6; |
69 |
|
|
70 |
|
/** The underlying callable */ |
71 |
|
private final Callable<V> callable; |