001 package com.hammurapi.util;
002
003 import java.util.concurrent.Executor;
004
005 /**
006 * Executes command in the current thread.
007 * This class is used by multi-threaded routines when
008 * another implementation of executor is not available to simplify the logic
009 * by not having <code>if (executor==null)</code> branch.
010 * @author Pavel Vlasov
011 *
012 */
013 public class InlineExecutor implements Executor {
014
015 /**
016 * Singleton inline executor.
017 */
018 public static final Executor INSTANCE = new InlineExecutor();
019
020 public void execute(Runnable command) {
021 command.run();
022 }
023
024 }