Endpoint references are not registered in domain registry
---------------------------------------------------------

                 Key: TUSCANY-3957
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3957
             Project: Tuscany
          Issue Type: Bug
    Affects Versions: Java-SCA-2.0
            Reporter: Greg Dritschler
            Priority: Minor


EndpointReferences are not always registered in the domain registry.  This 
causes a problem in the following scenario with asynchronous invocation.

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());
            }

I see this code in CompositeActivator to add an EndpointReference to the domain 
registry.

            // 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.  There should be code to register the epr when it's bound after 
start time.  I am attaching a patch to do this.  I realize 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.  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to