Wrap an Executor so that it always executes with this context as the #current context. It is generally expected that #currentContextExecutor(Executor) would be used more commonly than this method. One scenario in which this executor may be useful is when a single thread i
(final Executor e)
| 599 | * @see #currentContextExecutor(Executor) |
| 600 | */ |
| 601 | public Executor fixedContextExecutor(final Executor e) { |
| 602 | final class FixedContextExecutor implements Executor { |
| 603 | @Override |
| 604 | public void execute(Runnable r) { |
| 605 | e.execute(wrap(r)); |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | return new FixedContextExecutor(); |
| 610 | } |
| 611 | |
| 612 | /** |
| 613 | * Create an executor that propagates the {@link #current} context when {@link Executor#execute} |
no outgoing calls