public T removeElement() throws InterruptedException {
        lock.lock();
        try {
            while ( tasksQueue.isEmpty() ) {
                fullCondition.await();
            }

            T result = tasksQueue.remove();
            emptyCondition.signalAll();
            return result;
        } finally {
            lock.unlock();
        }
    }