Attach this context, thus enter a new scope within which this context is #current. The previously current context is returned. It is allowed to attach contexts where #isCancelled() is true. Instead of using attach() and #detach(Context) most use-cases are
()
| 424 | * }}</pre> |
| 425 | */ |
| 426 | public Context attach() { |
| 427 | Context prev = storage().doAttach(this); |
| 428 | if (prev == null) { |
| 429 | return ROOT; |
| 430 | } |
| 431 | return prev; |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Reverse an {@code attach()}, restoring the previous context and exiting the current scope. |