Re: Jini Service as local object reference

Francisco Dário Mourão <[email protected]> Wed, 2 Jan 2008 18:58:43 -0000
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Hi again,
Thanks to all for the help.
I'm following Dan's hint. It seems the easiest way to have things working for now.

I've already performed some tests and I'm already seeing results. 
With a client and two services running all on the same host, a method call to a service with a MemoryServerEndpoint based exporter takes in average 1/3 of the time of a method call to a service with a TcpServerEndpoint based exporter!

My question is: Is this code reliable? Is it used anywhere?
I couldn't find much info about it. I want to use it in my production environment. It passed the basic tests, but I'm afraid of any bugs that I'm not seeing.

Thanks again.

-----Original Message-----
From: Dan Creswell [mailto:[email protected]] 
Sent: quinta-feira, 27 de Dezembro de 2007 10:26
To: [email protected]
Subject: Re: Jini Service as local object reference

Hi Francisco,

You could also check out the custom endpoints created by Bob Scheifler:

https://user-rscheifler.dev.java.net/

You'd basically need the aggregate endpoint wrapped around a remote and
a local endpoint (also in the package).

Happy Christmas,

Dan.

Francisco Dário Mourão wrote:
> Hi there,
> 
> I'm trying to develop a service which can be configured to run as Jini
> service or to run as local object, when used by a client application.
> 
> The reason is that I want to remove the RMI overhead of a method call
> when, in a specific environment, I know that I'll always use the service
> locally.
> 
>  
> 
> To be more specific:
> 
> I launch an environment by launching several services. For instance:
> ClientService and ServerService (ClientService acting as client of
> ServerService).
> 
> On an environment type A: I launch a ClientService on host1 and
> ServerService on host2 (Both Jini services)
> 
> On an environment type B: I launch a ClientService and ServerService on
> host1 (Both Jini services)
> 
> What I want to do is to improve performance for type B environments, by
> configuring ServerService to run as a "local service", and thus
> eliminate the RMI overhead of ClientService to ServerService method
> calls and ServerService event invocations to ClientService.
> 
>  
> 
> When ServerService run as Jini, I'm creating a pure RMI proxy for the
> implementation:
> 
>  
> 
> serviceImplementation = *new* ServerServiceImpl(*this*);
> 
> proxy = (IService) exporter.export(serviceImplementation);
> 
>  
> 
> ... where exporter is configured like this:
> 
>  
> 
> /* Exporter for the server proxy */
> 
>     exporter = new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
> 
>                                      new BasicILFactory());
> 
>  
> 
>  
> 
> What should I do to have ClientService to use ServerService as if it
> were a local object reference?
> 
> At a first glance you could say that to accomplish what I want, I would
> simply have to make ServerService proxy = serviceImplementation:
> 
>  
> 
> serviceImplementation = *new* ServerServiceImpl(*this*);
> 
> proxy = (IService) serviceImplementation;
> 
>  
> 
>  
> 
> That was what I thought too. The problem is that my
> serviceImplementation is not Serializable!!!
> 
>  
> 
> Does anyone know how can I overcome this problem?
> 
> Should I implement a LocalProxy which implements Serializable? But how
> can it reference the serviceImplementation when serviceImplementation is
> not serializable?
> 
>  
> 
> Thanx for the help.
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> --------------------------------------------------------------------------
> Getting Started: http://www.jini.org/wiki/Category:Getting_Started
> Community Web Site: http://jini.org jini-users Archive:
> http://archives.java.sun.com/archives/jini-users.html Unsubscribing:
> email "signoff JINI-USERS" to [email protected]

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]