class OrderedDtpExecutor extends DtpExecutor {

    private final ExecutorSelector selector = new HashedExecutorSelector();

    private final List<Executor> childExecutors = Lists.newArrayList();

    public OrderedDtpExecutor(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              TimeUnit unit,
                              BlockingQueue<Runnable> workQueue) {
        this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
                Executors.defaultThreadFactory(), new AbortPolicy());
    }

    public OrderedDtpExecutor(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              TimeUnit unit,
                              BlockingQueue<Runnable> workQueue,
                              ThreadFactory threadFactory) {
        this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
                threadFactory, new AbortPolicy());
    }

    public OrderedDtpExecutor(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              TimeUnit unit,
                              BlockingQueue<Runnable> workQueue,
                              RejectedExecutionHandler handler) {
        this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
                Executors.defaultThreadFactory(), handler);
    }

    public OrderedDtpExecutor(int corePoolSize,
                              int maximumPoolSize,
                              long keepAliveTime,
                              TimeUnit unit,
                              BlockingQueue<Runnable> workQueue,
                              ThreadFactory threadFactory,
                              RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
        for (int i = 0; i < corePoolSize; i++) {
            ChildExecutor childExecutor = new ChildExecutor(workQueue.size() + workQueue.remainingCapacity());
            childExecutors.add(childExecutor);
        }
    }

    @Override
    public void execute(Runnable command) {
        if (command == null) {
            throw new NullPointerException();
        }
        if (command instanceof Ordered) {
            doOrderedExecute(command, ((Ordered) command).hashKey());
        } else {
            doUnorderedExecute(command);
        }
    }

    public void execute(Runnable command, Object hashKey) {
        if (Objects.nonNull(hashKey)) {
            doOrderedExecute(command, hashKey);
        } else {
            doUnorderedExecute(command);
        }
    }

    @Override
    public <T> Future<T> submit(Callable<T> task) {
        if (task == null) {
            throw new NullPointerException();
        }
        Object hashKey = task instanceof Ordered ? ((Ordered) task).hashKey() : null;
        RunnableFuture<T> futureTask = newTaskFor(task);
        execute(futureTask, hashKey);
        return futureTask;
    }

    public <T> Future<T> submit(Callable<T> task, Object hashKey) {<FILL_FUNCTION_BODY>}

    private void doOrderedExecute(Runnable command, Object hashKey) {
        Executor executor = selector.select(childExecutors, hashKey);
        executor.execute(command);
    }

    private void doUnorderedExecute(Runnable command) {
        super.execute(command);
    }

    void onBeforeExecute(Thread t, Runnable r) {
        beforeExecute(t, r);
    }

    void onAfterExecute(Runnable r, Throwable t) {
        afterExecute(r, t);
    }

    @Override
    public long getCompletedTaskCount() {
        long count = 0;
        for (Executor executor : childExecutors) {
            count += ((ChildExecutor) executor).getCompletedTaskCount();
        }
        return super.getCompletedTaskCount() + count;
    }

    @Override
    public long getTaskCount() {
        long count = 0;
        for (Executor executor : childExecutors) {
            count += ((ChildExecutor) executor).getTaskCount();
        }
        return super.getTaskCount() + count;
    }

    @Override
    public void onRefreshQueueCapacity(int capacity) {
        for (Executor executor : childExecutors) {
            ChildExecutor childExecutor = (ChildExecutor) executor;
            if (childExecutor.getTaskQueue() instanceof VariableLinkedBlockingQueue) {
                ((VariableLinkedBlockingQueue<Runnable>) childExecutor.getTaskQueue()).setCapacity(capacity);
            }
        }
    }

    private final class ChildExecutor implements Executor, Runnable {

        private final BlockingQueue<Runnable> taskQueue;

        private final LongAdder completedTaskCount = new LongAdder();

        private final LongAdder rejectedTaskCount = new LongAdder();

        private boolean running;

        ChildExecutor(int queueSize) {
            if (queueSize <= 0) {
                taskQueue = new SynchronousQueue<>();
                return;
            }
            taskQueue = new VariableLinkedBlockingQueue<>(queueSize);
        }

        @Override
        public void execute(Runnable command) {
            boolean start = false;
            command = getEnhancedTask(command, getTaskWrappers());
            synchronized (this) {
                try {
                    if (!taskQueue.add(command)) {
                        rejectedTaskIncrement(command);
                        throw new RejectedExecutionException("Task " + command + " rejected from " + this);
                    }
                } catch (IllegalStateException ex) {
                    rejectedTaskIncrement(command);
                    throw ex;
                }

                if (!running) {
                    running = true;
                    start = true;
                }
            }
            if (start) {
                doUnorderedExecute(this);
            }
        }

        @Override
        public void run() {
            Thread thread = Thread.currentThread();
            Runnable task;
            while ((task = getTask()) != null) {
                onBeforeExecute(thread, task);
                Throwable thrown = null;
                try {
                    task.run();
                } catch (RuntimeException x) {
                    thrown = x;
                    throw x;
                } finally {
                    onAfterExecute(task, thrown);
                    completedTaskCount.increment();
                }
            }
        }

        private void rejectedTaskIncrement(Runnable runnable) {
            AwareManager.beforeReject(runnable, OrderedDtpExecutor.this);
            rejectedTaskCount.increment();
        }

        private synchronized Runnable getTask() {
            Runnable task = taskQueue.poll();
            if (task == null) {
                running = false;
            }
            return task;
        }

        public BlockingQueue<Runnable> getTaskQueue() {
            return taskQueue;
        }

        public long getTaskCount() {
            return completedTaskCount.sum() + taskQueue.size();
        }

        public long getCompletedTaskCount() {
            return completedTaskCount.sum();
        }

        @Override
        public String toString() {
            return super.toString() +
                    "[queue size = " + taskQueue.size() +
                    ", completed tasks = " + completedTaskCount +
                    ", rejected tasks = " + rejectedTaskCount +
                    ", running = " + running +
                    "]";
        }
    }

}

        if (task == null) {
            throw new NullPointerException();
        }
        RunnableFuture<T> futureTask = newTaskFor(task);
        execute(futureTask, hashKey);
        return futureTask;
    
<methods>public void <init>(int, int, long, java.util.concurrent.TimeUnit, BlockingQueue<java.lang.Runnable>) ,public void <init>(int, int, long, java.util.concurrent.TimeUnit, BlockingQueue<java.lang.Runnable>, java.util.concurrent.ThreadFactory) ,public void <init>(int, int, long, java.util.concurrent.TimeUnit, BlockingQueue<java.lang.Runnable>, java.util.concurrent.RejectedExecutionHandler) ,public void <init>(int, int, long, java.util.concurrent.TimeUnit, BlockingQueue<java.lang.Runnable>, java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler) ,public void execute(java.lang.Runnable, long) ,public void execute(java.lang.Runnable) ,public int getAwaitTerminationSeconds() ,public Set<java.lang.String> getAwareNames() ,public List<org.dromara.dynamictp.common.entity.NotifyItem> getNotifyItems() ,public java.util.concurrent.ThreadPoolExecutor getOriginal() ,public List<java.lang.String> getPlatformIds() ,public Set<java.lang.String> getPluginNames() ,public long getQueueTimeout() ,public java.lang.String getRejectHandlerType() ,public long getRunTimeout() ,public List<org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper> getTaskWrappers() ,public java.lang.String getThreadPoolAliasName() ,public java.lang.String getThreadPoolName() ,public void initialize() ,public boolean isNotifyEnabled() ,public boolean isPreStartAllCoreThreads() ,public boolean isRejectEnhanced() ,public boolean isTryInterrupt() ,public boolean isWaitForTasksToCompleteOnShutdown() ,public void setAllowCoreThreadTimeOut(boolean) ,public void setAwaitTerminationSeconds(int) ,public void setAwareNames(Set<java.lang.String>) ,public void setNotifyEnabled(boolean) ,public void setNotifyItems(List<org.dromara.dynamictp.common.entity.NotifyItem>) ,public void setPlatformIds(List<java.lang.String>) ,public void setPluginNames(Set<java.lang.String>) ,public void setPreStartAllCoreThreads(boolean) ,public void setQueueTimeout(long) ,public void setRejectEnhanced(boolean) ,public void setRejectHandler(java.util.concurrent.RejectedExecutionHandler) ,public void setRejectHandlerType(java.lang.String) ,public void setRunTimeout(long) ,public void setTaskWrappers(List<org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper>) ,public void setThreadPoolAliasName(java.lang.String) ,public void setThreadPoolName(java.lang.String) ,public void setTryInterrupt(boolean) ,public void setWaitForTasksToCompleteOnShutdown(boolean) ,public void shutdown() ,public List<java.lang.Runnable> shutdownNow() <variables>protected int awaitTerminationSeconds,private Set<java.lang.String> awareNames,private boolean notifyEnabled,private List<org.dromara.dynamictp.common.entity.NotifyItem> notifyItems,private List<java.lang.String> platformIds,private Set<java.lang.String> pluginNames,private boolean preStartAllCoreThreads,private long queueTimeout,private boolean rejectEnhanced,private java.lang.String rejectHandlerType,private long runTimeout,private List<org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper> taskWrappers,private java.lang.String threadPoolAliasName,protected java.lang.String threadPoolName,private boolean tryInterrupt,protected boolean waitForTasksToCompleteOnShutdown