Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
replace AtomicBoolean with normal boolean because used in synchronize…
Browse files Browse the repository at this point in the history
…d methods
  • Loading branch information
Stephan.Praetsch committed Jun 13, 2024
1 parent adda920 commit d1b1b9b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.awspring.cloud.messaging.listener.Acknowledgment;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import lombok.Getter;
import lombok.NonNull;
Expand All @@ -22,7 +21,7 @@ public class MessageWrapper<I> {
@Getter
private final Message<I> message;

private final AtomicBoolean acknowledged = new AtomicBoolean(false);
private boolean acknowledged = false;

public String getMessageId() {
return message.getHeaders().get("MessageId", String.class);
Expand All @@ -39,11 +38,11 @@ public synchronized void acknowledge() {
throw new NullPointerException("there is no \"Acknowledgment\" in the message headers");
}
acknowledgment.acknowledge().get(2, TimeUnit.MINUTES);
acknowledged.set(true);
acknowledged = true;
}

public synchronized void changeMessageVisibility(AmazonSQS sqsClient, ChangeMessageVisibilityRequest request) {
if (acknowledged.get()) {
if (acknowledged) {
return;
}
sqsClient.changeMessageVisibility(request);
Expand Down

0 comments on commit d1b1b9b

Please sign in to comment.