@Override
      public void run() {
        // ensure we don't run this task multiple times
        synchronized (this) {
          // quick exit if we already marked the task complete
          if (TimeoutExceptionInjector.this.complete) return;
          // mark the task is run, to avoid repeats
          TimeoutExceptionInjector.this.complete = true;
        }
        long end = EnvironmentEdgeManager.currentTime();
        TimeoutException tee =
          new TimeoutException("Timeout caused Foreign Exception", start, end, maxTime);
        String source = "timer-" + timer;
        listener.receive(new ForeignException(source, tee));
      }
Create a generic timer for a task/process.
@param listener listener to notify if the process times out
@param maxTime  max allowed running time for the process. Timer starts on calls to
                {@link #start()}
hbase-server/src/main/java/org/apache/hadoop/hbase/errorhandling/TimeoutExceptionInjector.java