class StarterRestarter extends Thread {

        public StarterRestarter(String name) {
            super(name);
        }

        @Override
        public void run() {<FILL_FUNCTION_BODY>}

        public void startConsumer() throws IOException, TimeoutException {
            Consumer consumer = new UrlConsumer(channel());
            channel().exchangeDeclare(getExchange(), "direct", true);
            channel().queueDeclare(getQueueName(), durable,
                    false, autoDelete, null);
            channel().queueBind(getQueueName(), getExchange(), getQueueName());
            if (prefetchCount != null)
                channel().basicQos(prefetchCount);
            consumerTag = channel().basicConsume(getQueueName(), false, consumer);
            logger.info("started AMQP consumer uri=" + getAmqpUri() + " exchange=" + getExchange() + " queueName=" + getQueueName() + " consumerTag=" + consumerTag);
        }
    }

            while (!Thread.interrupted()) {
                try {
                    lock.lockInterruptibly();
                    logger.finest("Checking consumerTag=" + consumerTag + " and pauseConsumer=" + pauseConsumer);
                    try {
                        if (consumerTag == null && !pauseConsumer) {
                            // start up again
                            try {
                                startConsumer();
                            } catch (IOException | TimeoutException e) {
                                logger.log(Level.SEVERE, "problem starting AMQP consumer (will try again after 10 seconds)", e);
                            }
                        }

                        if (consumerTag != null && pauseConsumer) {
                            try {
                                if (consumerTag != null) {
                                    logger.info("Attempting to cancel URLConsumer with consumerTag=" + consumerTag);
                                    channel().basicCancel(consumerTag);
                                    consumerTag = null;
                                    logger.info("Cancelled URLConsumer.");
                                }
                            } catch (IOException | TimeoutException e) {
                                logger.log(Level.SEVERE, "problem cancelling AMQP consumer (will try again after 10 seconds)", e);
                            }
                        }

                    } finally {
                        lock.unlock();
                    }

                    Thread.sleep(10 * 1000);
                } catch (InterruptedException e) {
                    return;
                }
            }
        
<no_super_class>