[ https://issues.apache.org/jira/browse/TUSCANY-1674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rashmi Hunt updated TUSCANY-1674: --------------------------------- Attachment: RuntimeWireImpl.java This patch is applied on top of Tuscany revision r572771 > Missing NonBlockingInterceptor on service wire > ---------------------------------------------- > > Key: TUSCANY-1674 > URL: https://issues.apache.org/jira/browse/TUSCANY-1674 > Project: Tuscany > Issue Type: Bug > Reporter: Rashmi Hunt > Attachments: RuntimeWireImpl.java > > > The reason why NonBlockingInterceptor is needed on the service wire as well > is, if there is no nonBlockingInterceptor at service wire and if the service > is invoked not from a reference then there is no asynch support even if the > call is non blocking. For e.g if a pure webservice client (or any pure > client) is sending a request to a non blocking service call, since Tuscany > code is currently missing a nonBlockingInterceptor on the service wire, there > is no async support for this case, even though the service operation is > marked as non-blocking. > Solution is straightforward. Add NonBlockingInterCeptor on service wire in > RuntimeWireImpl.initInvocationChains() for the service wire clause > Binding serviceBinding = wireTarget.getBinding(); > if (operation.isNonBlocking()) { > addNonBlockingInterceptor(service, serviceBinding, chain); > } > And add a new addNonBlockingInterceptor() function which takes params > service, serviceBinding, chain > /** > * Add a non-blocking interceptor if the service binding needs it > * > * @param service > * @param binding > * @param chain > */ > private void addNonBlockingInterceptor(ComponentService service, Binding > binding, InvocationChain chain) { > ServiceBindingProvider provider = > ((RuntimeComponentService)service).getBindingProvider(binding); > if (provider != null) { > boolean supportsAsyncOneWayInvocation = false; > if (provider instanceof ServiceBindingProvider2) { > supportsAsyncOneWayInvocation = > ((ServiceBindingProvider2)provider).supportsAsyncOneWayInvocation(); > } else { > // Must be an old provider that doesn't have this method. If > this is a old provider keep the behavior > // as is where there is no nonBlockingInterceptor on the > service wire. If a binding provider needs a > // nonBlocking interceptor, it would have been implemented > ServiceBindingProvider2 and indicated > // supportsAsyncOneWayInvocation accordingly > supportsAsyncOneWayInvocation = true; > } > if (!supportsAsyncOneWayInvocation) { > chain.addInterceptor(new > NonBlockingInterceptor(workScheduler)); > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]