wood burning stoves 2.0
The moose likes Distributed Java and the fly likes RMI: remote listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI: remote listener" Watch "RMI: remote listener" New topic

RMI: remote listener

Nikos Bouzoukis

Joined: Jul 30, 2004
Posts: 7

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

Joined: Jan 23, 2002
Posts: 11962
"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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Nikos Bouzoukis

Joined: Jul 30, 2004
Posts: 7
okkkkkk, sorry
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

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

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Nikos Bouzoukis

Joined: Jul 30, 2004
Posts: 7
I saw your reply just yesterday 'cause I was away on holidays. It helped me a lot, especially the link. Thanks!
I agree. Here's the link: http://aspose.com/file-tools
subject: RMI: remote listener
It's not a secret anymore!