* @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;
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