• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reverse RMI calls

 
Joseph Macer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I've been reading up on RMI, and on running a "hello world" application a limitation occurs to me - can a Server (running the rmiregistry service) make function calls on a Client?
 
Joseph Macer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, in retrospect I think I'm being unclear as to what I want to do.

I have a server that has to deal with several clients at any given time, and performance & concurrency is an issue. I am hoping that I can use RMI to use function calls to communicate, rather than my own protocol over sockets. I know how to bind functions to a local rmiregistry, and call them from a client, but I want the server to be able to call functions on the client as well.

EDIT: As I'm digging through more literature, another problem occurs to me - how do you keep track of multiple users if there's only generic function calls going on? Will I have to pass some sort of identifier with each call? Do I need to bind a set of functions every time a user logs on?
[ June 16, 2008: Message edited by: Joseph Macer ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joseph:
but I want the server to be able to call functions on the client as well.

Then your client also behaves as a server!
You can make RMI calls only on remote objects. So, if the client does not have a remote object published on a registry then no one can really make any RMI calls on the client.
So, in your scenario, the client also has to publish a remote object and your client acts as a server for some calls and client for others.

Joseph:
EDIT: As I'm digging through more literature, another problem occurs to me - how do you keep track of multiple users if there's only generic function calls going on? Will I have to pass some sort of identifier with each call?

There is no implicit session associated with RMI calls. You would have to create one programatically.

Joseph: Do I need to bind a set of functions every time a user logs on?

I really dont understand this.
[ June 17, 2008: Message edited by: Nitesh Kant ]
 
Joseph Macer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, this topic is just confusing the heck out of me.

What I meant by "binding a set" everytime someone logs on, is I don't understand how I can keep track of an arbitrary number of users. Most examples I've seen add an integer ID to all their function calls to identify which user make the function call, which seems odd to me.

The bigger question for me is how to replace my custom protocol with something built-in, because I'm sure there are more efficient ways to communicate then my scheme. I turned to RMI because function calls would make my life very easy. But I'm stuck on how to send function calls both ways, and how to support many users.
 
Iraklis Mathiopoulos
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google up "RMI Callbacks". I got all my info from http://www.ryerson.ca/~dgrimsha/courses/cps841/RMICallbacks.html

Hope it helps you too.

UPDATE:
Regarding your user management issues you will have to implement your own user management framework. From my very limited experience in RMI I can tell you that it provides a fantastic way of passing/executing serializable objects/methods back and forth with minimal effort. However this is where its scope ends. Any additional functionality like user authentication, user permissions, etc has to be implemented by you.


Imath.
[ June 26, 2008: Message edited by: Iraklis Mathiopoulos ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!