There are two calls to stop().

1. When the container is stopped.
2. When the consumer is restarted after an exception is thrown.

For 1, we need to block the delivery thread because, before we call `stop()`, we want to give the consumer thread time to drain the queue - but stop the delivery thread from adding new messages to the queue.
For 2, there is no need to block the delivery thread because we are closing the channel anyway (further down in `stop()`).

In any case, for 2., we would immediately wake the delivery thread (the next line after the `cancelled.set()` wakes it.