This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI: remote listener

 
Nikos Bouzoukis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am building an RMI app and I need the client to be able to listen events that take place at the server. In other words I need a sort of a remote listener. Do you have any ideas how I can manage to do it?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"night fall",

Welcome to the JavaRanch! We have a couple of rules here, one of which is the naming policy which requires the use of real or real-looking display name -- please go to your profile to edit your display name into something compliant.

Thanks!
 
Nikos Bouzoukis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okkkkkk, sorry
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the name change Nikos!

Having a client add a listener to the server in RMI is usually called an "RMI callback". Basically you make an interface that extends Remote to be your listener interface. You add methods to the server to add and remove listeners from a Collection internal to the server (like a Vector or ArrayList) you then add a method to iterate through the Collection and call each listener whenever the event you were waiting for happens.

Doing a google search for "RMI listener" or "RMI callback" will provide several more in-depth explanations and a few examples with source code. One example I found is at - http://www.ryerson.ca/~dgrimsha/courses/cps841/RMICallbacks.html
 
Nikos Bouzoukis
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw your reply just yesterday 'cause I was away on holidays. It helped me a lot, especially the link. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic