Re: Jini Service as local object reference
Dan Creswell <[email protected]> Thu, 27 Dec 2007 10:25:45 +0000
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
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]