// if the target is a component and the operation is non-blocking
connect(outboundChain, inboundChain, null, true);
} else {
connect(outboundChain, inboundChain, null, false);
}
Service service = (Service) source;
InboundInvocationChain chain = service.getInboundWire().getInvocationChains().get(operation);
chain.setTargetInvoker(invoker);
} else {
if (target instanceof Component && (isOneWayOperation || operationHasCallback)) {
// if the target is a component and the operation is non-blocking
connect(outboundChain, inboundChain, invoker, true);
} else {
connect(outboundChain, inboundChain, invoker, false);
}
}
}
// create source callback chains and connect them if target callback chains exist
Map<Operation<?>, OutboundInvocationChain> sourceCallbackChains =
targetWire.getSourceCallbackInvocationChains(source.getName());
for (InboundInvocationChain inboundChain : sourceWire.getTargetCallbackInvocationChains().values()) {
Operation<?> operation = inboundChain.getOperation();
if (sourceCallbackChains != null && sourceCallbackChains.get(operation) != null) {
String name = operation.getName();
BuilderConfigException e =
new BuilderConfigException("Source callback chain should not exist for operation [" + name + "]");
e.setIdentifier(sourceWire.getReferenceName());
throw e;
}
Operation targetOp =
(Operation)targetWire.getServiceContract().getCallbackOperations().get(operation.getName());
OutboundInvocationChain outboundChain = wireService.createOutboundChain(targetOp);
targetWire.addSourceCallbackInvocationChain(source.getName(), targetOp, outboundChain);
if (source instanceof Component) {
Component component = (Component) source;
TargetInvoker invoker = component.createTargetInvoker(null, operation);
connect(outboundChain, inboundChain, invoker, false);
} else if (source instanceof CompositeReference) {
CompositeReference compRef = (CompositeReference) source;
ServiceContract sourceContract = sourceWire.getServiceContract();
TargetInvoker invoker = compRef.createCallbackTargetInvoker(sourceContract, operation);
connect(outboundChain, inboundChain, invoker, false);
} else if (source instanceof Service) {
Service service = (Service) source;
ServiceContract sourceContract = sourceWire.getServiceContract();
TargetInvoker invoker = service.createCallbackTargetInvoker(sourceContract, operation);
connect(outboundChain, inboundChain, invoker, false);
}
}
if (postProcessorRegistry != null) {
// run wire post-processors