// dispatch thread is ready to flush the dispatch list
clearDispatchList = true;
}
void deliverAcks() {
MessageAck ack = null;
if (deliveryingAcknowledgements.compareAndSet(false, true)) {
if (this.optimizeAcknowledge) {
synchronized(deliveredMessages) {
ack = makeAckForAllDeliveredMessages(MessageAck.STANDARD_ACK_TYPE);
if (ack != null) {
deliveredMessages.clear();
ackCounter = 0;
}
}
} else {
ack = pendingAck;
}
if (ack != null) {
final MessageAck ackToSend = ack;
if (executorService == null) {
executorService = Executors.newSingleThreadExecutor();
}
executorService.submit(new Runnable() {
public void run() {