if (logger.isLoggable(Level.FINE)) {
logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
}
for (EndpointReference endpointReference : reference.getEndpointReferences()){
RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference;
// If the reference is already resolved then start it now. This currently
// important for async references which have native async bindings as the
// reference provider has to register a response listener regardless of
// whether the reference has been used or not.
if (epr.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED ||
epr.getStatus() == EndpointReference.Status.RESOLVED_BINDING){
// As we only care about starting references at build time in the
// async case at the moment check that the binding supports native async
// and that the reference is an async reference
ReferenceBindingProvider bindingProvider = epr.getBindingProvider();
if (bindingProvider instanceof EndpointReferenceAsyncProvider &&
((EndpointReferenceAsyncProvider)bindingProvider).supportsNativeAsync() &&
epr.isAsyncInvocation()){
// it's resolved so start it now
try {
// The act of getting invocation chains starts the reference in the late binding case
// so just use that here
epr.getInvocationChains();
} catch (Throwable ex){
Monitor.error(monitor, this, "core-messages", "StartException", ex);
rethrow(ex);
}
}