Skip to content

Commit

Permalink
use the has method
Browse files Browse the repository at this point in the history
clear queue for push messaging.
  • Loading branch information
caalador committed Jan 10, 2025
1 parent 998dfb5 commit d47d5ff
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private JsonObject preparePayload(final JsonArray reqInvocations,
* The contents of the request to send
*/
public void send(final JsonObject payload) {
if (!messageQueue.isEmpty()) {
if (hasQueuedMessages()) {
messageQueue.add(payload);
return;
}
Expand Down Expand Up @@ -238,6 +238,7 @@ private void sendPayload(final JsonObject payload) {
}

if (push != null && push.isBidirectional()) {
messageQueue.clear();
// When using bidirectional transport, the payload is not resent
// to the server during reconnection attempts.
// Keep a copy of the message, so that it could be resent to the
Expand Down Expand Up @@ -377,7 +378,7 @@ public void setClientToServerMessageId(int nextExpectedId, boolean force) {
ApplicationConstants.CLIENT_TO_SERVER_ID) < nextExpectedId) {
pushPendingMessage = null;
}
if (!messageQueue.isEmpty()) {
if (hasQueuedMessages()) {
synchronized (messageQueue) {
// If queued message is the expected one. remove from queue
// and sen next message if any.
Expand Down

0 comments on commit d47d5ff

Please sign in to comment.