wiki:KaRMI/CallProtocol

Version 1 (modified by hauma, 15 years ago) (diff)

Created initial version.

The KaRMI Call Protocol

Currently, the KaRMI call protocol for a remote method invocation looks approximately like the following:

Client side

ClientConnection c = Technology.getContext(...)

c.openSendCall()
// marshal arguments
c.closeSendCall()

normalReturn = c.openReceiveResult()
if (normalReturn) {
    // unmarshal result
} else {
    // unmarshal exeption ex
}
c.closeReceiveResult()

if (normalReturn) {
    return result;
} else {
    throw ex;
}

Server side

// The connection c belongs one-to-one to the serving 
// thread.
ServerConnection c;

c.openReceiveCall()
// unmarshal arguments
c.closeReceiveCall()

try {
    try {
        // application code
    } catch (Exception ex) {
        c.openSendResult(false)
        // marshal ex
        throw ex
    }
    c.openSendResult(true)
    // marshal result
} catch (Exception ex) {}
c.closeSendResult()