• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RMI Callback - Help Needed!

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created an application that uses RMI with a Client and a Server. They can both communicate effectively but i would like to implement RMI Callback so that the Server can pass back messages and invoke methods on the client.

I have looked at numerous RMI callback examples but they are often poorly explained or use long winded examples, all of which are going completely over my head.

My question is: Are there some simple steps or lines of code that can be added to add RMI Callback functionality to an exisiting RMI implementation?

Any help or examples would be hugely appreciated.

Thanks in advance!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RMI is a one-way mechanism - the client calls the server. If you want the server to be able to call the client, you'll need to set up the client as an RMI server as well.
 
Emile Ghazzawi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand the concept and logic behind RMI Callback i am just struggling to understand how i change my current RMI code to make it happen.

Could someone please explain the steps necessary to do so. I am a complete Java beginner way out of my depth here but it is something that i would really like to understand and get working!

Any help is much appreciated.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you have RMI working one way, just do the same the other way around to make it happen in the opposite direction. There is no way to set up an RMI connection to work both ways.
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Emily,
as Ulf Dittmer suggests, most common way to achieve this is exporting (in rmi sense) a listener object client side.
This lead to open a ServerSocket client side, with can be problematic in almost all network environments.
Other way is using long lived connections as i suggest in this post:
RMI client behind NAT. Callback implementation .

Recommended way in production environments is using a polling mecanishm.

Regards,
Oricio
[ July 29, 2007: Message edited by: Oricio Ocle ]
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this tutorial:
http://java.sun.com/developer/onlineTraining/rmi/exercises/RMICallback/index.html
reply
    Bookmark Topic Watch Topic
  • New Topic