| 1 | package com.hammurapi.common; |
| 2 | |
| 3 | import java.util.concurrent.Executor; |
| 4 | |
| 5 | /** |
| 6 | * Executes command in the current thread. |
| 7 | * This class is used by multi-threaded routines when |
| 8 | * another implementation of executor is not available to simplify the logic |
| 9 | * by not having <code>if (executor==null)</code> branch. |
| 10 | * @author Pavel Vlasov |
| 11 | * |
| 12 | */ |
| 13 | public class InlineExecutor implements Executor { |
| 14 | |
| 15 | /** |
| 16 | * Singleton inline executor. |
| 17 | */ |
| 18 | public static final Executor INSTANCE = new InlineExecutor(); |
| 19 | |
| 20 | public void execute(Runnable command) { |
| 21 | command.run(); |
| 22 | } |
| 23 | |
| 24 | } |