public void addFirst(T event) throws RejectedExecutionException {
        lock.lock();
        try {
            if (closed) throw new RejectedExecutionException("Can't accept an event because the accumulator is closed.");

            K key = event.key();
            Deque<T> queue = queues.get(key);
            if (queue == null) {
                queue = new LinkedList<>();
                queues.put(key, queue);
                if (!inflightKeys.contains(key)) {
                    addAvailableKey(key);
                }
            }
            queue.addFirst(event);
            size++;
        } finally {
            lock.unlock();
        }
    }
Adds an {{@link Event}} at the front of the queue.

@param event An {{@link Event}}.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/runtime/EventAccumulator.java