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?
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.