validateReferenceInterfaceCompatibility();
List<InvocationChain> chainList = new ArrayList<InvocationChain>();
if(sourceContract != null && targetContract != null) {
RuntimeComponentReference reference = (RuntimeComponentReference)getReference();
for (Operation operation : sourceContract.getInterface().getOperations()) {
Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
if (targetOperation == null) {
throw new ServiceRuntimeException("No matching operation for " + operation.getName()
+ " is found in reference "
+ getComponent().getURI()
+ "#"
+ reference.getName());
}
InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true, phaseManager, isAsyncInvocation());
if (operation.isNonBlocking()) {
addNonBlockingInterceptor(chain);
}
chainList.add(chain);
addReferenceBindingInterceptor(chain, operation);
}
}
// Set the chains until it's fully populated. If we initialize too early, any exception could
// leave this endpoint reference in a wrong state with an empty chain.
chains = chainList;
wireProcessor.process(this);
if (isAsyncInvocation()){
// Fix up all of the operation chain response paths to point back to the implementation provided
// async response handler
//ImplementationProvider implementationProvider = ((RuntimeComponent)getComponent()).getImplementationProvider();
RuntimeComponentReference theReference = (RuntimeComponentReference)this.getReference();
RuntimeComponent theComponent = theReference.getComponent();
ImplementationProvider implementationProvider = theComponent.getImplementationProvider();
if (implementationProvider instanceof ImplementationAsyncProvider){
for (InvocationChain chain : getInvocationChains()){
InvokerAsyncResponse asyncResponseInvoker = ((ImplementationAsyncProvider)implementationProvider).createAsyncResponseInvoker(chain.getSourceOperation());
if (chain.getHeadInvoker() instanceof InterceptorAsync){