class StateMachine {

  public void execute(final Callable<Void> process, final StateT success, final StateT fail) {
    lock.writeLock().lock();
    try {
      process.call();
      logger.trace("Success to execute {}", process);
      if (null != success) {
        changeState(success);
      }
    } catch (Throwable th) {
      if (null != fail) {
        logger.trace("Fail to execute {}", process);
        changeState(fail);
      }
    } finally {
      lock.writeLock().unlock();
    }
  }

  public  StateMachine(final StateT initialState);

}