Search code examples
javarmi

RMI Callbacks - what is the on the wire protocol?


What is the "on the wire", TCP/IP level protocol when Java RMI is used with client callbacks?

Specifically, does the server initiate a separate TCP/IP connection to the client to make the callback, or is an existing TCP/IP connection used?

This reference: https://www.cis.upenn.edu/~bcpierce/courses/629/jdkdocs/guide/rmi/spec/rmi-protocol.doc.html indicates a HTTP POST is encapsulated in RMI to invoke the method, is the HTTP POST made by the server to the client for a callback?


Solution

  • What is the "on the wire", TCP/IP level protocol when Java RMI is used with client callbacks?

    JRMP: Java Remote Method Protocol, unless you're using RMI/IIOP or JBoss or JERI or something else with a different RMI wire protocol.

    Specifically, does the server initiate a separate TCP/IP connection to the client to make the callback

    Yes.

    or is an existing TCP/IP connection used?

    No.

    This reference: https://www.cis.upenn.edu/~bcpierce/courses/629/jdkdocs/guide/rmi/spec/rmi-protocol.doc.html indicates a HTTP POST is encapsulated in RMI to invoke the method, is the HTTP POST made by the server to the client for a callback?

    Your link is an extremely ancient copy (1997) of the RMI Specification. The current version, dated 2010, is available directly at Oracle. What it actually indicates is that it uses HTTP POST 'when circumstances warrant', i.e. as a fallback strategy if a direct TCP connection fails, and that only works if the RMI-CGI servlet is installed at the target.

    RMI has no internal distinction between RMI calls and callbacks, so whether or not HTTP tunnelling is used is irrelevant to whether it's a callback or not, and vice versa.