in src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java [367:386]
private void enqueueSend() {
final int currentOutstanding = outstanding.get();
// Below outstanding limit so we can send immediately?
if (currentOutstanding < concurrency) {
sendBatch();
return;
}
// Enqueue as pending for sending by the earliest available concurrent request slot
pending = true;
pendingTopics.offer(this);
// Tell the listener that a topic became pending for sending as early as possible.
listener.topicPending(Publisher.this, topic, currentOutstanding, concurrency);
// Attempt to send pending to guard against losing a race while enqueuing this topic as pending.
sendPending();
}