code: String waitAndGetMessage() {
      synchronized (this) {
        // Wait for a message to send.
        while (this.statusMessagesToSend.isEmpty()) {
          try {
            this.wait();
          } catch (final InterruptedException e) {
            LOG.log(Level.FINE, "Interrupted. Ignoring.");
          }
        }
  
        // Send the message
        return getMessageForStatus(this.statusMessagesToSend.poll());
      }
    }
docs: Waits for a status message to be available and returns it.
  
  @return the first available status message.