public static void doInEventLoop(EventExecutor eventExecutor, Runnable runnable) {
    if (eventExecutor.inEventLoop()) {
      runnable.run();
    } else {
      eventExecutor.submit(runnable);
    }
  }
Runs a task in the given {@link EventExecutor}. Runs immediately if the current thread is in the
eventExecutor.

@param eventExecutor Executor to run task in.
@param runnable Task to run.
ambry-commons/src/main/java/com/github/ambry/commons/NettyUtils.java