Re: Jini Service as local object reference

Guy Korland <[email protected]> Wed, 26 Dec 2007 19:37:44 +0200
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
HI Francisco,

 

We in GigaSpaces encountered this issue few years ago, and provided a special solution especially to the problem you described.

When using GigaSpaces we provide an alternative exporter which replaces the RMI layer and dynamically realizes when the service is embedded.

In this case we provide a direct in memory call to the service or in our terms we provide a "smart stub" that provide this capability seamless.

 

To read more: http://www.gigaspaces.com/wiki/display/GS6/Communication+Protocol+-+6.0

You should also check the Remoting model provided by the OpenSpaces: 

http://www.gigaspaces.com/wiki/display/GS6/Open+Spaces+Remoting+Component+-+Sync+Remoting

 

_____________________________

Guy 

________________________________

From: Francisco Dário Mourão [mailto:[email protected]] 
Sent: Wednesday, December 26, 2007 2:58 PM
To: [email protected]
Subject: Jini Service as local object reference

 

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]