ESBCOMP-38 Review transaction resume / suspend for async model.
parent
31c254c1ce
commit
f14621cda6
|
@ -1060,6 +1060,7 @@ public class OutboundMessageProcessor {
|
||||||
Transaction transaction = (Transaction) outboundExchange.getProperty(
|
Transaction transaction = (Transaction) outboundExchange.getProperty(
|
||||||
MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
|
MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
|
||||||
boolean txResumed = false;
|
boolean txResumed = false;
|
||||||
|
boolean shouldSuspendTx = false;
|
||||||
if (transaction != null) {
|
if (transaction != null) {
|
||||||
if (mLog.isLoggable(Level.FINE)) {
|
if (mLog.isLoggable(Level.FINE)) {
|
||||||
mLog.log(Level.FINE, "Got transaction context from message exchange " + outboundExchange.getExchangeId() + ". About to resume transaction before the Dispatch call...");
|
mLog.log(Level.FINE, "Got transaction context from message exchange " + outboundExchange.getExchangeId() + ". About to resume transaction before the Dispatch call...");
|
||||||
|
@ -1218,6 +1219,7 @@ public class OutboundMessageProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
shouldSuspendTx = true;
|
||||||
dispatch.invokeOneWay(soapMsg);
|
dispatch.invokeOneWay(soapMsg);
|
||||||
} else {
|
} else {
|
||||||
if (mMonitorEnabled) {
|
if (mMonitorEnabled) {
|
||||||
|
@ -1234,6 +1236,7 @@ public class OutboundMessageProcessor {
|
||||||
ctx.setProbe(callDispatchMeasurement);
|
ctx.setProbe(callDispatchMeasurement);
|
||||||
AsyncResponseHandler<SOAPMessage> handler = AsyncResponseDispatcher.instance().getHandler(ctx);
|
AsyncResponseHandler<SOAPMessage> handler = AsyncResponseDispatcher.instance().getHandler(ctx);
|
||||||
dispatch.invokeAsync(soapMsg, handler);
|
dispatch.invokeAsync(soapMsg, handler);
|
||||||
|
shouldSuspendTx = true;
|
||||||
/*if (mMonitorEnabled) {
|
/*if (mMonitorEnabled) {
|
||||||
try {
|
try {
|
||||||
LoggingMonitoringUtil.setCheckpoint(endpointMeta, trackingId, "Received-response-from-inout-remote-service", replySoapMsg.getSOAPPart().getEnvelope());
|
LoggingMonitoringUtil.setCheckpoint(endpointMeta, trackingId, "Received-response-from-inout-remote-service", replySoapMsg.getSOAPPart().getEnvelope());
|
||||||
|
@ -1259,12 +1262,12 @@ public class OutboundMessageProcessor {
|
||||||
if (dispatch != null)
|
if (dispatch != null)
|
||||||
endpointMeta.releaseDispatch(dispatch);
|
endpointMeta.releaseDispatch(dispatch);
|
||||||
|
|
||||||
if (txResumed) {
|
if (txResumed && shouldSuspendTx) {
|
||||||
if (mLog.isLoggable(Level.FINE)) {
|
if (mLog.isLoggable(Level.FINE)) {
|
||||||
mLog.log(Level.FINE, "Transction was resumed before the Dispatch call. Successfully received a SOAP response. " +
|
mLog.log(Level.FINE, "Transction was resumed before the Dispatch call. Successfully received a SOAP response. " +
|
||||||
"About to suspend the transaction before sending the reply in the message exchange...");
|
"About to suspend the transaction before sending the reply in the message exchange...");
|
||||||
}
|
}
|
||||||
//TransactionsUtil.suspendTransaction();
|
TransactionsUtil.suspendTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,15 +96,17 @@ public class AsyncResponseProcessor<T> implements Runnable {
|
||||||
context.getEndpoint().getEndpointStatus().incrementReceivedReplies();
|
context.getEndpoint().getEndpointStatus().incrementReceivedReplies();
|
||||||
replyHTTP((DataSource) result);
|
replyHTTP((DataSource) result);
|
||||||
} else {
|
} else {
|
||||||
final String err = Messages.getMessages(AsyncResponseProcessor.class).getString("HTTPBC-E1001");
|
//final String err = Messages.getMessages(AsyncResponseProcessor.class).getString("HTTPBC-E1001");
|
||||||
logger.warning(err);
|
suspendTransaction();
|
||||||
|
logger.warning("HTTPBC-E1001: Unsupported response media");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
suspendTransaction();
|
||||||
context.getChannel().send(context.getInout());
|
context.getChannel().send(context.getInout());
|
||||||
} catch (MessagingException ex) {
|
} catch (MessagingException ex) {
|
||||||
final String err = Messages.getMessages(AsyncResponseProcessor.class).getString("HTTPBC-E1002");
|
//final String err = Messages.getMessages(AsyncResponseProcessor.class).getString("HTTPBC-E1002");
|
||||||
logger.warning(err);
|
logger.warning(new StringBuilder("HTTPBC-E1002: ").append(ex.getMessage()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -272,7 +274,7 @@ public class AsyncResponseProcessor<T> implements Runnable {
|
||||||
private void resumeTransaction() {
|
private void resumeTransaction() {
|
||||||
javax.transaction.Transaction tx = (Transaction) context.getInout().getProperty(context.getInout().JTA_TRANSACTION_PROPERTY_NAME);
|
javax.transaction.Transaction tx = (Transaction) context.getInout().getProperty(context.getInout().JTA_TRANSACTION_PROPERTY_NAME);
|
||||||
if (tx != null) {
|
if (tx != null) {
|
||||||
TransactionsUtil.resumeTransaction(tx);
|
txResumed = TransactionsUtil.resumeTransaction(tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +282,7 @@ public class AsyncResponseProcessor<T> implements Runnable {
|
||||||
try {
|
try {
|
||||||
if (txResumed) {
|
if (txResumed) {
|
||||||
TransactionsUtil.suspendTransaction();
|
TransactionsUtil.suspendTransaction();
|
||||||
|
txResumed = false;
|
||||||
}
|
}
|
||||||
} catch (SystemException ex) {/* I hope noone uses misterious XA*/
|
} catch (SystemException ex) {/* I hope noone uses misterious XA*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue