public void enqueue(Task task) {
        if (destroyed.get()) {
            task.destroy();
            return;
        }
        synchronized (this) {
            queue.offer(task);
            if (queue.size() == 1) {
                notify();
            }
        }
    }
<p>Enqueues the given task in the list of tasks that this worker is to
process. If this thread has been destroyed previously, this method
invokes {@link Messenger.Task#destroy()}.</p>

@param task The task to enqueue.
messagebus/src/main/java/com/yahoo/messagebus/Messenger.java