@Override
    public T pull() throws InterruptedException {
        synchronized (taskQueue) {
            while (taskQueue.size() == 0 && !endOfData) {
                taskQueue.wait();
            }

            if (taskQueue.size() > 0) {
                T task = taskQueue.removeFirst();
                notifyUpdateSize(taskQueue.size());
                return task;
            }
        }
        Thread.currentThread().interrupt();
        return null;
    }