History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-25888
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Nikolay Chashnikov
Reporter: Matt Bishop
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

A better RemoteService template

Created: 11 Apr 08 01:03   Updated: 23 Jul 08 10:16
Component/s: GWT Support
Fix Version/s: Diana 8618

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 7,757
Fixed in build: 8,611
Severity: Low


 Description  « Hide
When one creates a "New GWT Remote Service" a nice App class is added to the RemoteService implementation. This App class template can be improved with the following version:

public static class App {
private static final MyServiceAsync _I = (MyServiceAsync) GWT.create(MyService.class);
static { String url = GWT.getModuleBaseURL() + "package.name/MyService"; ((ServiceDefTarget) _I).setServiceEntryPoint(url); }

public static MyServiceAsync get() { return _I; }
}

This template has several advantages:
1. instance is never checked for null state. This is a bit faster, plus it removes the unnecessary 'synchronized' modifier.
2. initializer is in static {} block, which is run when the class is loaded for the first time.
3. Class Init code is deleted in GWT JS code after it has been run once.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.