Re: Singleton instance in RPC AsynCall with two or more RPCs

2011-08-15 Thread J.Ganesan
I have encountered this problem  quite a few times. I would create
another class GreetingLoginServiceAsync, if possible extending
GreetingServiceAsync and creating a static method
getInstanceOfGreetingLoginServiceAsync().

J.Ganesan
www.DataStoreGwt.com

On Aug 13, 12:14 am, Miguel Ruiz Rodriguez 
wrote:
> Hi everybody,
>
> I´m using a solution that use a Singleton pattern to create and
> AsynCall class with the followin code.
>
> public interface GreetingServiceAsync
> {
>
>     /**
>      * Utility class to get the RPC Async interface from client-side
> code
>      */
>     public static final class Util
>     {
>         private static GreetingServiceAsync instance;
>
>         public static final GreetingServiceAsync getInstance()
>         {
>             if ( instance == null )
>             {
>                 instance = (GreetingServiceAsync)
> GWT.create( GreetingService.class );
>                 ServiceDefTarget target = (ServiceDefTarget) instance;
>                 target.setServiceEntryPoint( GWT.getModuleBaseURL() +
> "greet" );
>             }
>             return instance;
>         }
>
>         private Util()
>         {
>             // Utility class should not be instanciated
>         }
>     }
>
>     public void greetSongMostPopular(Integer size,
> AsyncCallback> asyncCallback);
>
> }
>
> So I had to add a new atribute with another Service
> (GreetingLoginServiceAsync), so what could I do? Must I set an input
> to getInstanceMethod with the name of the rpc service that I want
> create? Are there any best alternative to do this?
>
> Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Singleton instance in RPC AsynCall with two or more RPCs

2011-08-12 Thread Miguel Ruiz Rodriguez
Hi everybody,

I´m using a solution that use a Singleton pattern to create and
AsynCall class with the followin code.

public interface GreetingServiceAsync
{


/**
 * Utility class to get the RPC Async interface from client-side
code
 */
public static final class Util
{
private static GreetingServiceAsync instance;

public static final GreetingServiceAsync getInstance()
{
if ( instance == null )
{
instance = (GreetingServiceAsync)
GWT.create( GreetingService.class );
ServiceDefTarget target = (ServiceDefTarget) instance;
target.setServiceEntryPoint( GWT.getModuleBaseURL() +
"greet" );
}
return instance;
}

private Util()
{
// Utility class should not be instanciated
}
}

public void greetSongMostPopular(Integer size,
AsyncCallback> asyncCallback);


}

So I had to add a new atribute with another Service
(GreetingLoginServiceAsync), so what could I do? Must I set an input
to getInstanceMethod with the name of the rpc service that I want
create? Are there any best alternative to do this?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.