Home > Archive > Java Help > November 2005 > Possibilities with RMI
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Possibilities with RMI
|
|
|
| Hi,
I've been reading up on RMI but am still unsure if the following is
totally possible please advise, thanks.
I'd like to basically have a RMI Server working on 1 or more clients,
which connects to an overall server. I would like this server to send
out various different objects that implement a set interface. I would
like these sent over RMI, and processed on each client. The object then
- or a resulting object being returned. Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
Thanks for any help in advance.
David
| |
| VisionSet 2005-11-20, 7:01 pm |
|
"David" <david.goodyear@gmail.com> wrote in message
news:1132496985.204295.292230@o13g2000cwo.googlegroups.com...
> I'd like to basically have a RMI Server working on 1 or more clients,
> which connects to an overall server. I would like this server to send
Yes, the server initiates the call on the clients yes?
So atypical direction, the server must know what port the client is
available on.
> out various different objects that implement a set interface. I would
> like these sent over RMI, and processed on each client. The object then
> - or a resulting object being returned. Can this be done so that the
> RMI server on programmed into each client can contain no code about
> what it has to call on the objects, only use the interface methods,
> each object is guaranteed to implement?
>
RMI always works like this. You just extend Remote interface and objects
you receive will be of this type.
You can use an adapter object client side, if you prefer, to strip out the
RMI specific RemoteExceptions.
Or have I misunderstood?
Mike W
| |
| Roedy Green 2005-11-20, 7:01 pm |
| On 20 Nov 2005 06:29:45 -0800, "David" <david.goodyear@gmail.com>
wrote, quoted or indirectly quoted someone who said :
>Can this be done so that the
>RMI server on programmed into each client can contain no code about
>what it has to call on the objects, only use the interface methods,
>each object is guaranteed to implement?
In RMI, both ends must be compiled against identical code implementing
the classes. One end may end up using a stub, a class that has the
same signatures with each method implemented as a remote procedure
call.
Serialization, upon which RMI is based, can't create objects unless
the corresponding class file for them is present. So you can't for
example receive a Dog object as a return value (or send a Dog object
as a parameter for that matter) without the real Dog class being
present in the client.
One way to deal with pruning the list of classes in the client is to
use genjar.
see http://mindprod.com/jgloss/genjar.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
| |
| VisionSet 2005-11-20, 7:01 pm |
|
"VisionSet" <spam@ntlworld.com> wrote in message
news:yU%ff.2404$d4.650@newsfe4-win.ntli.net...
>
> "David" <david.goodyear@gmail.com> wrote in message
> news:1132496985.204295.292230@o13g2000cwo.googlegroups.com...
>
>
> RMI always works like this. You just extend Remote interface and objects
> you receive will be of this type.
> You can use an adapter object client side, if you prefer, to strip out the
> RMI specific RemoteExceptions.
> Or have I misunderstood?
>
Sorry if these opinions differ, I probably misunderstood.
I'm talking about the remote objects themselves, these never actually leave
the machine, RMI creates a stub at the other end that implements your Remote
interface.
Roedy is correct when talking about other objects.
You could also, instead of a common jar, create one app that runs in two
modes depending on the command line that launches it.
--
Mike W
| |
| Alex Molochnikov 2005-11-20, 7:01 pm |
| One small addition to what Roedy said: instead of having the required
implementation classes packaged into the client's jar file and deployed with
the client, you can keep them on the server side, and write a custom class
loader to fetch them from the server when needed. This way the client will
always get the latest version of the implementation.
Alex Molochnikov
Gestalt Corporation
"David" <david.goodyear@gmail.com> wrote in message
news:1132496985.204295.292230@o13g2000cwo.googlegroups.com...
> Hi,
>
> I've been reading up on RMI but am still unsure if the following is
> totally possible please advise, thanks.
>
> I'd like to basically have a RMI Server working on 1 or more clients,
> which connects to an overall server. I would like this server to send
> out various different objects that implement a set interface. I would
> like these sent over RMI, and processed on each client. The object then
> - or a resulting object being returned. Can this be done so that the
> RMI server on programmed into each client can contain no code about
> what it has to call on the objects, only use the interface methods,
> each object is guaranteed to implement?
>
> Thanks for any help in advance.
>
> David
>
| |
| Daniel Dyer 2005-11-20, 7:01 pm |
| On Sun, 20 Nov 2005 14:29:45 -0000, David <david.goodyear@gmail.com> wrote:
> I'd like to basically have a RMI Server working on 1 or more clients,
> which connects to an overall server. I would like this server to send
> out various different objects that implement a set interface. I would
> like these sent over RMI, and processed on each client. The object then
> - or a resulting object being returned. Can this be done so that the
> RMI server on programmed into each client can contain no code about
> what it has to call on the objects, only use the interface methods,
> each object is guaranteed to implement?
I'm sure you can do what you want with pure RMI, but it sounds like what
your trying to achieve would be a suitable application for JavaSpaces.
Take a look at these links, it might save you some work. The third one
seems to be the kind of thing that you are trying to develop (correct me
if I am wrong):
http://java.sun.com/developer/Books...troduction.html
http://www.javaworld.com/javaworld/...-jiniology.html
http://www.javaworld.com/jw-01-2000...-jiniology.html
Dan.
--
Daniel Dyer
http://www.dandyer.co.uk
| |
|
| Hi, thanks to everyone for all your answers. JavaSpaces seems an ideal
candiate to solve the problem. Im stil reading it all up now :S.
Yet another question :-
Does anyone know however, if the space can be run in an encryted link,
without the need for servers with SSL certificates? Maybe if anyone has
seen example code of this on the web somewhere as well?
Thanks yet again
David
|
|
|
|
|