@SuppressWarnings({ "rawtypes", "unchecked" })
    @Override
    public int compare(final Runnable left, final Runnable right) {
      if (left instanceof PriorityFutureTask && right instanceof PriorityFutureTask) {
        return ((PriorityFutureTask) left).compareTo((PriorityFutureTask) right);
      }
      return 0;
    }
Priority based thread pool executor which takes priority of the task to be executed into account.
app/com/linkedin/drelephant/priorityexecutor/PriorityBasedThreadPoolExecutor.java