@Override
    public void run() {
        tasksProcessed = 0;
        final long startTime = System.currentTimeMillis();
        Thread executorThread = Thread.currentThread();
        while (!executorThread.isInterrupted()) {
            try {
                final T t = taskSupplier.pull();
                if (t != null) {
                    taskExecutor.execute(t);
                    tasksProcessed++;
                }
            } catch (InterruptedException e) {
                logger.info(String.format("Task runner: %s interrupted.", executorThread.getName()));
                Thread.currentThread().interrupt();
            } catch (Exception e) {
                logger.error("Task throws an exception, ignoring...", e);
            }
        }

        threadUptime = System.currentTimeMillis() - startTime;

        logger.debug(String.format("Thread %s execution completed.", executorThread.getName()));
    }