* @return - the RuntimeEndpoint of the async callback
*/
private RuntimeEndpoint getAsyncCallback(Invocable source) {
if (!(source instanceof RuntimeEndpointReference))
return null;
RuntimeEndpointReference epr = (RuntimeEndpointReference)source;
if (!isAsyncInvocation(epr)) return null;
// Check to see if the binding supports async invocation natively
ReferenceBindingProvider eprProvider = epr.getBindingProvider();
if( eprProvider instanceof EndpointReferenceAsyncProvider) {
if( ((EndpointReferenceAsyncProvider)eprProvider).supportsNativeAsync() ) return null;
} // end if
RuntimeEndpoint endpoint;
synchronized (epr) {
endpoint = (RuntimeEndpoint)epr.getCallbackEndpoint();
// If the async callback endpoint is already created, return it...
if (endpoint != null)
return endpoint;
// Create the endpoint for the async callback
endpoint = createAsyncCallbackEndpoint(epr);
epr.setCallbackEndpoint(endpoint);
} // end synchronized
// Activate the new callback endpoint
startEndpoint(epr.getCompositeContext(), endpoint);
endpoint.getInvocationChains();
return endpoint;
} // end method setupAsyncCallback