You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@river.apache.org by Peter Firmstone <ji...@zeus.net.au> on 2010/04/19 23:17:39 UTC

Re: ServiceRegistrar - New Interfaces RFC

That subject should be RFC - Request for Comment.

I'm experimenting with Evolving ServiceRegistrar.

I know that evolving this interface is not a trivial undertaking and, 
previously change has been resisted for good reason.

There is a new Interface called StreamingServiceRegistrar,

This differs in the following way from ServiceRegistrar:

- EventRegistration notify(ServiceTemplate tmpl, int transitions, 
RemoteEventListener listener, MarshalledObject handback, long 
leaseDuration) throws RemoteException;
+ EventRegistration notify(MarshalledInstance handback, ServiceTemplate 
tmpl, int transitions, RemoteEventListener listener, long leaseDuration) 
throws RemoteException;
+ ObjectInput lookup(ServiceTemplate tmpl, boolean marshalled) throws 
RemoteException;

PortableServiceRegistrar is a common super interface for 
ServiceRegistrar and StreamingServiceRegistrar.

As you can see there is a replacement for notify, the handback's type 
has changed from MarshalledObject to MarshalledInstance.

The second new method allows objects to be received as a stream.

My comment from the source file:

    /**
     * Returns the service object (i.e., just ServiceItem.service) from an
     * item matching the template.  It makes the service object 
available via
     * the returned ObjectInput. 
     *
     * If the returned object cannot be deserialized, it can be returned in
     * marshalled form as a MarshalledInstance.
     *
     * Implementations of this interface should return the Objects in 
order of
     * their package implementation version, so that the number of 
ClassLoaders
     * are minimised and common packages can share code.  This is 
intended to
     * be used with the new codebase services (TODO once implemented).
     *
     * ObjectInput should be an InputStream, in order to minimise
     * memory consumption requirements at the client.
     *
     * @param tmpl template to match
     * @param marshalled if true return objects in marshalled form.
     * @return an object input that represents a service that matches the
     * specified template
     * @throws java.rmi.RemoteException
     * @see MarshalledInstance
     * @since 2.2.0
     */

Reggie's existing proxy can be changed to support both interfaces, 
however Java CDC clients will require a new proxy that doesn't include 
MarshalledObject or any missing RMI components.  This will require 
changes to Reggie's Registrar interface, used by reggie to communicate 
with it's proxy, not residing in the net.jini.* namespace, Registrar is 
safe to be altered.  By altering Registrar, Reggie can support two 
different proxy's with the same internal communication interface.  One 
proxy will have full functionality, the second will lack the 
ServiceRegistrar interface for Java CDC.

On that matter, has anyone extended IncomingUnicastResponse?

There are no classes in Apache River that extend this class, which has 
been designed for extension with protected fields.  I want to change the 
fields to have private access.

N.B. This is an experiment at this stage, so these changes could be 
rolled back, however please feel free to participate and help improve.

Also, I need someone who has excellent Ant skills (hint hint JC if 
you've got some time) to assist me to run tests on different JVM 
versions, compile some release artifacts with different compiler options 
(don't want to compile release artifacts for the Java 5 platform, or 
greater, with -jsr14 )

Cheers,

Peter.



Peter Firmstone wrote:
> Please see the following in the latest commit:
>
> PortableServiceRegistrar - SuperInterface of ServiceRegistrar
> StreamingServiceRegistrar - extends PortableServiceRegistrar.
>
> http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/net/jini/core/lookup/ 
>
> http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/net/jini/core/lookup/PortableServiceRegistrar.java?revision=935433&view=markup 
>
> http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/net/jini/core/lookup/StreamingServiceRegistrar.java?revision=935433&view=markup 
>
>
> All comments and suggestions welcome.
>
> Best Regards,
>
> Peter Firmstone.
>