Skip to content

Commit

Permalink
Simplify DeadLetterQueueOverflowException throwing
Browse files Browse the repository at this point in the history
- Only throw DeadLetterQueueOverflowException on enqueue, as
enqueueIfPresent already invokes enqueue
- Use the sequenceIdentifier constructor for simplicity

#2021
  • Loading branch information
smcvb committed Aug 8, 2022
1 parent 5a3f633 commit 3052d27
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ public static <M extends Message<?>> InMemorySequencedDeadLetterQueue<M> default
public void enqueue(@Nonnull Object sequenceIdentifier,
@Nonnull DeadLetter<? extends M> letter) throws DeadLetterQueueOverflowException {
if (isFull(sequenceIdentifier)) {
throw new DeadLetterQueueOverflowException(
"No room left to enqueue [" + letter.message() + "] for identifier ["
+ sequenceIdentifier + "] since the queue is full."
);
throw new DeadLetterQueueOverflowException(sequenceIdentifier);
}

if (logger.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ default boolean enqueueIfPresent(@Nonnull Object sequenceIdentifier,
if (!contains(sequenceIdentifier)) {
return false;
}

if (isFull(sequenceIdentifier)) {
throw new DeadLetterQueueOverflowException(sequenceIdentifier);
}

enqueue(sequenceIdentifier, letterBuilder.get());
return true;
}
Expand Down

0 comments on commit 3052d27

Please sign in to comment.