* block until the whole MEP is complete, as they have no other way to get their reply message.
*/
// THREADSAFE issue: Multiple threads could be trying to initialize the callback receiver
// so it is synchronized. It is not done within the else clause to avoid the
// double-checked lock antipattern.
CallbackReceiver callbackReceiver;
synchronized (axisOp) {
if (axisOp.getMessageReceiver() != null &&
axisOp.getMessageReceiver() instanceof CallbackReceiver) {
callbackReceiver = (CallbackReceiver) axisOp.getMessageReceiver();
} else {
if (log.isDebugEnabled()) {
log.debug("Creating new callback receiver");
}
callbackReceiver = new CallbackReceiver();
axisOp.setMessageReceiver(callbackReceiver);
if (log.isDebugEnabled()) log.debug("OutInAxisOperation: callbackReceiver " + callbackReceiver + " : " + axisOp);
}
}
SyncCallBack internalCallback = null;
if (callback != null) {
callbackReceiver.addCallback(mc.getMessageID(), callback);
if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating callback");
} else if (axisCallback != null) {
callbackReceiver.addCallback(mc.getMessageID(), axisCallback);
if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating axis callback");
} else {
if (log.isDebugEnabled()) {
log.debug("Creating internal callback");
}
internalCallback = new SyncCallBack();
callbackReceiver.addCallback(mc.getMessageID(), internalCallback);
if (log.isDebugEnabled()) log.debug("OutInAxisOperationClient: Creating internal callback");
}
/**
* If USE_CUSTOM_LISTENER is set to 'true' the replyTo value will not be replaced and Axis2 will not