}
private void initServiceBindingInvocationChains() {
// add the binding interceptors to the service binding wire
ServiceBindingProvider provider = getBindingProvider();
if ((provider != null) && (provider instanceof EndpointProvider)) {
((EndpointProvider)provider).configure();
}
// add the policy interceptors to the service binding wire
List<PolicyProvider> pps = getPolicyProviders();
if (pps != null) {
for (PolicyProvider p : pps) {
Interceptor interceptor = p.createBindingInterceptor();
if (interceptor != null) {
bindingInvocationChain.addInterceptor(interceptor);
} // end if
} // end for
} // end if
// This is strategically placed before the RuntimeInvoker is added to the end of the
// binding chain as the RuntimeInvoker doesn't need to take part in the response
// processing and doesn't implement InvokerAsyncResponse
if (isAsyncInvocation()){
// fix up the invocation chains to point back to the
// binding chain so that async response messages
// are processed correctly
for (InvocationChain chain : getInvocationChains()){
Invoker invoker = chain.getHeadInvoker();
if (invoker instanceof InterceptorAsync){
((InterceptorAsync)invoker).setPrevious((InvokerAsyncResponse)bindingInvocationChain.getTailInvoker());
} else {
// TODO - raise an error. Not doing that while
// we have the old async mechanism in play
}
} // end for
// fix up the binding chain response path to point back to the
// binding provided async response handler
ServiceBindingProvider serviceBindingProvider = getBindingProvider();
if (serviceBindingProvider instanceof EndpointAsyncProvider){
EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider;
InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker();
if (bindingInvocationChain.getHeadInvoker() instanceof InterceptorAsync){
((InterceptorAsync)bindingInvocationChain.getHeadInvoker()).setPrevious(asyncResponseInvoker);