eclipse-paho / eclipse-paho/paho.mqtt.java

Misleading javadoc in ClientState#send() Method

Open
#833 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

I am looking at the source code of `org.eclipse.paho.client.mqttv3.internal.ClientState` to understand what happens if the `send` method is called faster than the messages can be processed by the client.

I am using the Async client. As far as I understand, the messages to publish are added to `pendingMessages`, even though it is QoS 0. This will lead to `actualInFlight` being incremented as soon as a message from `pendingMessages` is being processed.

In the `send` method an Exception is thrown if `actualInFlight >= this.maxInflight`. So why does the javadoc state that `This method will block until there is room in the inFlightWindow for the message`? Shouldn't the method be documented to throw an exception if the `inFlightWindow` is full? Doesn't this javadoc fit more to the `get` message, which calls `queueLock.wait();` if -- among other conditions -- maxInflight is exceeded?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.