This commit is contained in:
Clebert Suconic 2018-01-23 11:51:42 -05:00
commit 6ad29e4039
1 changed files with 36 additions and 18 deletions

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.protocol.openwire.amq;
import javax.jms.InvalidDestinationException; import javax.jms.InvalidDestinationException;
import javax.jms.ResourceAllocationException; import javax.jms.ResourceAllocationException;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -27,6 +28,7 @@ import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.io.IOCallback;
import org.apache.activemq.artemis.core.message.impl.CoreMessageObjectPools; import org.apache.activemq.artemis.core.message.impl.CoreMessageObjectPools;
import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.postoffice.RoutingStatus; import org.apache.activemq.artemis.core.postoffice.RoutingStatus;
@ -428,12 +430,15 @@ public class AMQSession implements SessionCallback {
this.connection.getContext().setDontSendReponse(false); this.connection.getContext().setDontSendReponse(false);
connection.sendException(exceptionToSend); connection.sendException(exceptionToSend);
} else { } else {
server.getStorageManager().afterCompleteOperations(new IOCallback() {
@Override
public void done() {
if (sendProducerAck) { if (sendProducerAck) {
try { try {
ProducerAck ack = new ProducerAck(producerInfo.getProducerId(), messageSend.getSize()); ProducerAck ack = new ProducerAck(producerInfo.getProducerId(), messageSend.getSize());
connection.dispatchAsync(ack); connection.dispatchAsync(ack);
} catch (Exception e) { } catch (Exception e) {
this.connection.getContext().setDontSendReponse(false); connection.getContext().setDontSendReponse(false);
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
connection.sendException(e); connection.sendException(e);
} }
@ -449,6 +454,19 @@ public class AMQSession implements SessionCallback {
} }
} }
} }
@Override
public void onError(int errorCode, String errorMessage) {
try {
final IOException e = new IOException(errorMessage);
ActiveMQServerLogger.LOGGER.warn(errorMessage);
connection.serviceException(e);
} catch (Exception ex) {
ActiveMQServerLogger.LOGGER.debug(ex);
}
}
});
}
} }
})) { })) {
this.connection.getContext().setDontSendReponse(false); this.connection.getContext().setDontSendReponse(false);