Simon, Hmm, that does sound a lot simpler. Let me think about that.
On Wed, Sep 28, 2011 at 11:07 AM, Simon Laws <[email protected]>wrote: > On Wed, Sep 28, 2011 at 3:55 PM, Greg Dritschler > <[email protected]> wrote: > > I have a question pertaining to asynchronous services. In my scenario, > the > > asynchronous service implementation serializes the ResponseDispatch > object, > > tucks it away, and deserializes it later when it is ready to respond. > > Deserialization drives the readObject method in AsyncResponseInvoker. > > Let's say the AsyncResponseInvoker was set up such that the target > address > > is an EPR. In this case readObject is going to try to relocate the EPR > in > > the domain registry. > > if (responseTargetAddress instanceof EndpointReference){ > > // fix the target as in this case it will be an EPR > > EndpointReference epr = (EndpointReference)responseTargetAddress; > > responseTargetAddress = > (T)retrieveEndpointReference(epr.getURI()); > > } > > My question is, when is the EPR added to the domain registry? > > I see this code in CompositeActivator: > > // 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 { > > start(compositeContext, epr); > > } catch (Throwable ex){ > > Monitor.error(monitor, this, "core-messages", > > "StartException", ex); > > rethrow(ex); > > } > > } > > The call to start(compositeContext, epr) will add the epr to the > registry. > > So this code handles the case where the endpoint reference target is > > resolved at start time. It seems like there should be code in the > > EndpointReferenceBinder to register the epr when it's bound after start > time > > but I can't find it. Should we add it? > > > > I realize that even if we update the binder, this still leaves a window > > between start and the first use of a reference where the epr is not > > registered in the domain. This is not something I need to address in my > > scenario. > > Greg > > Hi > > I have a feeling there used the code but I can't find it. I'd have no > objection to adding it. The window leaves an inconsistency. Maybe we > should always register then and rely on the status to tell us what's > happening. > > Simon > > -- > Apache Tuscany committer: tuscany.apache.org > Co-author of a book about Tuscany and SCA: tuscanyinaction.com >
