import com.google.common.base.Preconditions;
import com.google.common.base.Ticker;
import com.google.common.base.Verify;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.Optional;
}
// Ready to transmit
- currentInflight.offer(e);
- LOG.debug("Enqueued request {} to queue {}", request, this);
+
+ if (currentInflight.offer(e)) {
+ LOG.debug("Enqueued request {} to queue {}", request, this);
+ } else {
+ // This shouldn't happen since the queue has unlimited capacity but check anyway to avoid FindBugs warning
+ // about checking return value.
+ LOG.warn("Fail to enqueued request {} to queue {}", request, this);
+ }
e.retransmit(backend, nextTxSequence(), now);
if (expectingTimer == null) {
* - if a matching entry is not found, but it makes sense to keep looking at other queues, return null
* - if a conflicting entry is encountered, indicating we should ignore this request, return an empty Optional
*/
+ @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
+ justification = "Returning null Optional is documented in the API contract.")
private static Optional<SequencedQueueEntry> findMatchingEntry(final Queue<SequencedQueueEntry> queue,
final ResponseEnvelope<?> envelope) {
// Try to find the request in a queue. Responses may legally come back in a different order, hence we need