Create a new context which will cancel itself after the given duration from now. The returned context will cascade cancellation of its parent. Callers may explicitly cancel the returned context prior to the deadline just as for #withCancellation(). If the unit of work completes befor
(long duration, TimeUnit unit,
ScheduledExecutorService scheduler)
| 266 | * </pre> |
| 267 | */ |
| 268 | public CancellableContext withDeadlineAfter(long duration, TimeUnit unit, |
| 269 | ScheduledExecutorService scheduler) { |
| 270 | return withDeadline(Deadline.after(duration, unit), scheduler); |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Create a new context which will cancel itself at the given {@link Deadline}. |