class TaskQueue extends VariableLinkedBlockingQueue<Runnable> {

    private static final long serialVersionUID = -1L;

    private transient EagerDtpExecutor executor;

    public TaskQueue(int queueCapacity) {
        super(queueCapacity);
    }

    public void setExecutor(EagerDtpExecutor exec) {
        executor = exec;
    }

    @Override
    public boolean offer(@NonNull Runnable runnable) {<FILL_FUNCTION_BODY>}

    /**
     * Force offer task
     *
     * @param o task
     * @param timeout timeout
     * @param unit unit
     * @return offer success or not
     * @throws RejectedExecutionException if executor is terminated.
     * @throws InterruptedException if interrupted while waiting.
     */
    public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException {
        if (executor.isShutdown()) {
            throw new RejectedExecutionException("Executor is shutdown.");
        }
        return super.offer(o, timeout, unit);
    }
}

        if (executor == null) {
            throw new RejectedExecutionException("The task queue does not have executor.");
        }
        int currentPoolThreadSize = executor.getPoolSize();
        if (currentPoolThreadSize == executor.getMaximumPoolSize()) {
            return super.offer(runnable);
        }
        // have free worker. put task into queue to let the worker deal with task.
        if (executor.getSubmittedTaskCount() < currentPoolThreadSize) {
            return super.offer(runnable);
        }
        // return false to let executor create new worker.
        if (currentPoolThreadSize < executor.getMaximumPoolSize()) {
            return false;
        }
        // currentPoolThreadSize >= max
        return super.offer(runnable);
    
<methods>public void <init>() ,public void <init>(int) ,public void <init>(Collection<? extends java.lang.Runnable>) ,public void clear() ,public boolean contains(java.lang.Object) ,public int drainTo(Collection<? super java.lang.Runnable>) ,public int drainTo(Collection<? super java.lang.Runnable>, int) ,public Iterator<java.lang.Runnable> iterator() ,public boolean offer(java.lang.Runnable, long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException,public boolean offer(java.lang.Runnable) ,public java.lang.Runnable peek() ,public java.lang.Runnable poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException,public java.lang.Runnable poll() ,public void put(java.lang.Runnable) throws java.lang.InterruptedException,public int remainingCapacity() ,public boolean remove(java.lang.Object) ,public void setCapacity(int) ,public int size() ,public Spliterator<java.lang.Runnable> spliterator() ,public java.lang.Runnable take() throws java.lang.InterruptedException,public java.lang.Object[] toArray() ,public T[] toArray(T[]) ,public java.lang.String toString() <variables>private int capacity,private final java.util.concurrent.atomic.AtomicInteger count,transient Node<java.lang.Runnable> head,private transient Node<java.lang.Runnable> last,private final java.util.concurrent.locks.Condition notEmpty,private final java.util.concurrent.locks.Condition notFull,private final java.util.concurrent.locks.ReentrantLock putLock,private static final long serialVersionUID,private final java.util.concurrent.locks.ReentrantLock takeLock