Hi,

The first approach is preferable because the second one implies an
additional network round trip.



Kind regards,
Alex.

On Mon, Aug 14, 2017 at 2:44 PM, luqmanahmad [via Apache Ignite Users] <
[email protected]> wrote:

> Hi there,
>
> Let say we have a node singleton service with a method called
> doSomething()
>
> Now if we want to call the service from a servlet we can either inject the
> service in the servlet directly like:
>
> MyService service = ignite.services().serviceProxy("myService",
> "MyService.class", false);
> service.doSomething();
>
> or
>
> create a IgniteCallable and send it to server for execution. For example
>
> private class MyServiceCallable implements IgniteCallable {
>         @ServiceResource(serviceName = "myService")
>         private MyService myService;
>
>         @Override
>         public Object call() throws Exception {
>             return myService.doSomething();
>         }
> }
>
> getGrid().compute().call(new MyServiceCallable());
>
> Now the second call I know will be sent to the server for execution and
> the results will be sent back. Question is what is the difference between
> two and is there any performance cost using the first technique? Just
> looking for the best approach.
>
> Thanks,
> Luqman
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-ignite-users.70518.x6.nabble.com/Calling-
> service-methods-from-servlets-tp16160.html
> To start a new topic under Apache Ignite Users, email
> [email protected]
> To unsubscribe from Apache Ignite Users, click here
> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=YWxleGFuZGVyLmZlZG90b2ZmQGdtYWlsLmNvbXwxfC0xMzYxNTU0NTg=>
> .
> NAML
> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Calling-service-methods-from-servlets-tp16160p16164.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to