use of org.apache.activemq.artemis.core.exception.ActiveMQXAException in project activemq-artemis by apache.
the class ServerSessionImpl method xaResume.
@Override
public synchronized void xaResume(final Xid xid) throws Exception {
if (tx != null) {
final String msg = "Cannot resume, session is currently doing work in a transaction " + tx.getXid();
throw new ActiveMQXAException(XAException.XAER_PROTO, msg);
} else {
Transaction theTx = resourceManager.getTransaction(xid);
if (theTx == null) {
final String msg = "Cannot find xid in resource manager: " + xid;
throw new ActiveMQXAException(XAException.XAER_NOTA, msg);
} else {
if (theTx.getState() != Transaction.State.SUSPENDED) {
throw new ActiveMQXAException(XAException.XAER_PROTO, "Cannot resume transaction, it is not suspended " + xid);
} else {
tx = theTx;
tx.resume();
}
}
}
}
use of org.apache.activemq.artemis.core.exception.ActiveMQXAException in project activemq-artemis by apache.
the class ServerSessionPacketHandler method onSessionSend.
private void onSessionSend(Packet packet) {
this.storageManager.setContext(session.getSessionContext());
try {
Packet response = null;
boolean requiresResponse = false;
try {
final SessionSendMessage message = (SessionSendMessage) packet;
requiresResponse = message.isRequiresResponse();
this.session.send(EmbedMessageUtil.extractEmbedded(message.getMessage()), this.direct);
if (requiresResponse) {
response = new NullResponseMessage();
}
} catch (ActiveMQIOErrorException e) {
response = onActiveMQIOErrorExceptionWhileHandlePacket(e, requiresResponse, response, this.session);
} catch (ActiveMQXAException e) {
response = onActiveMQXAExceptionWhileHandlePacket(e, requiresResponse, response);
} catch (ActiveMQQueueMaxConsumerLimitReached e) {
response = onActiveMQQueueMaxConsumerLimitReachedWhileHandlePacket(e, requiresResponse, response);
} catch (ActiveMQException e) {
response = onActiveMQExceptionWhileHandlePacket(e, requiresResponse, response);
} catch (Throwable t) {
response = onCatchThrowableWhileHandlePacket(t, requiresResponse, response, this.session);
}
sendResponse(packet, response, false, false);
} finally {
this.storageManager.clearContext();
}
}
use of org.apache.activemq.artemis.core.exception.ActiveMQXAException in project activemq-artemis by apache.
the class ServerSessionPacketHandler method onSessionConsumerFlowCredit.
private void onSessionConsumerFlowCredit(Packet packet) {
this.storageManager.setContext(session.getSessionContext());
try {
Packet response = null;
boolean requiresResponse = false;
try {
SessionConsumerFlowCreditMessage message = (SessionConsumerFlowCreditMessage) packet;
session.receiveConsumerCredits(message.getConsumerID(), message.getCredits());
} catch (ActiveMQIOErrorException e) {
response = onActiveMQIOErrorExceptionWhileHandlePacket(e, requiresResponse, response, this.session);
} catch (ActiveMQXAException e) {
response = onActiveMQXAExceptionWhileHandlePacket(e, requiresResponse, response);
} catch (ActiveMQQueueMaxConsumerLimitReached e) {
response = onActiveMQQueueMaxConsumerLimitReachedWhileHandlePacket(e, requiresResponse, response);
} catch (ActiveMQException e) {
response = onActiveMQExceptionWhileHandlePacket(e, requiresResponse, response);
} catch (Throwable t) {
response = onCatchThrowableWhileHandlePacket(t, requiresResponse, response, this.session);
}
sendResponse(packet, response, false, false);
} finally {
this.storageManager.clearContext();
}
}
Aggregations