RequestFactory: Request vs InstanceRequest

119 views
Skip to first unread message

Alexander Orlov

unread,
Oct 10, 2011, 2:48:33 AM10/10/11
to google-we...@googlegroups.com
There is no clear advice in the docs when you should use which kind of request. Using regular Requests (need to reference static methods on the server side) is not so verbose (on the client side) as using InstanceRequests. But what's about the performance or other implications?

Thomas Broyer

unread,
Oct 10, 2011, 5:29:53 AM10/10/11
to google-we...@googlegroups.com
First, note that Request does not necessarily mean static method: you can have instance methods on your service class using a ServiceLocator (whose responsibility will be to instantiate the service class).

That being said, there's absolutely no performance implication about using Request with static method, with instance method, or InstanceRequest (well, Request for an instance method will require instantiating the service, but that's only done once, and the instance is then kept in a cache; so it's really negligible).

Other implications? well, none that I know.

But first you have to understand that Request is about calling methods on your service (class referenced by @Service or @ServiceName on your RequestContext) whereas InstanceRequest is about calling methods on a domain object (class used as the first type argument, instance corresponding to the one you pass to the using() method.
Reply all
Reply to author
Forward
0 new messages