(final Promise<T> target)
| 283 | } |
| 284 | |
| 285 | @SuppressWarnings("unchecked") |
| 286 | private final void link(final Promise<T> target) { |
| 287 | while (true) { |
| 288 | final Object curr = state; |
| 289 | if (curr instanceof SatisfiedFuture) { |
| 290 | target.become((SatisfiedFuture<T>) curr); |
| 291 | return; |
| 292 | } else { |
| 293 | Object newState; |
| 294 | if (target instanceof Continuation) |
| 295 | newState = new LinkedContinuation<>((Continuation<T, ?>) target); |
| 296 | else |
| 297 | newState = target; |
| 298 | if (cas(curr, newState)) { |
| 299 | if (curr != null) |
| 300 | ((WaitQueue<T>) curr).forward(target); |
| 301 | return; |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | @SuppressWarnings("unchecked") |
| 308 | protected final <R> Future<R> continuation(final Continuation<T, R> c) { |
no test coverage detected