Movatterモバイル変換


[0]ホーム

URL:


CONTENTS |PREV |NEXTJava Remote Method Invocation


10.2 RMI TransportProtocol

The wire format for RMI isrepresented by aStream. The terminology adopted herereflects a client perspective.Out refers to outputmessages andIn refers to input messages. The contents ofthe transport header arenot formatted using objectserialization.
Stream:
Out

In

The input and outputstreams used by RMI are paired. EachOut stream has acorrespondingIn stream. AnOut stream in thegrammar maps to the output stream of a socket (from theclient's perspective). AnIn stream (in the grammar)is paired with the corresponding socket's input stream. Sinceoutput and input streams are paired, the only header informationneeded on an input stream is an acknowledgment as to whether theprotocol is understood; other header information (such as the magicnumber and version number) can be implied by the context of streampairing.


10.2.1 Format ofan Output Stream

An output stream in RMIconsists of transportHeader information followed by asequence ofMessages. Alternatively, an output stream cancontain an invocation embedded in the HTTP protocol.

Out:

Header Messages
HttpMessage

Header:

0x4a 0x52 0x4d 0x49Version Protocol

Version:

0x00 0x01

Protocol:

StreamProtocol
SingleOpProtocol
MultiplexProtocol

StreamProtocol:

0x4b

SingleOpProtocol:

0x4c

MultiplexProtocol:

0x4d

Messages:

Message
Messages Message

TheMessagesare wrapped within a particular protocol as specified byProtocol. For theSingleOpProtocol, there mayonly be oneMessage after theHeader, and thereis no additional data that theMessage is wrapped in. TheSingleOpProtocol is used for invocation embedded in HTTPrequests, where interaction beyond a single request and response isnot possible.

For theStreamProtocol and theMultiplexProtocol, theserver must respond with a a byte0x4e acknowledgingsupport for the protocol, and anEndpointIdentifier thatcontains the host name and port number that the server can see isbeing used by the client. The client can use this information todetermine its host name if it is otherwise unable to do that forsecurity reasons. The client must then respond with anotherEndpointIdentifier that contains the client's defaultendpoint for accepting connections. This can be used by a server intheMultiplexProtocol case to identify the client.

For theStreamProtocol, after this endpoint negotiation, theMessages are sent over the output stream without anyadditional wrapping of the data. For theMultiplexProtocol, the socket connection is used as theconcrete connection for a multiplexed connection, as described inSection 10.6, "RMI'sMultiplexing Protocol." Virtual connections initiated overthis multiplexed connection consist of a series ofMessages as described below.

There are three types ofoutput messages:Call,Ping andDgcAck.ACall encodes a method invocation. APing is atransport-level message for testing liveness of a remote virtualmachine. ADGCAck is an acknowledgment directed to aserver's distributed garbage collector that indicates thatremote objects in a return value from a server have been receivedby the client.

Message:

Call
Ping
DgcAck

Call:

0x50CallData

Ping:

0x52

DgcAck:

0x54UniqueIdentifier


10.2.2 Format ofan Input Stream

There are currently threetypes of input messages:ReturnData,HttpReturnandPingAck.ReturnData is the result of a"normal" RMI call. AnHttpReturn is a returnresult from an invocation embedded in the HTTP protocol. APingAck is the acknowledgment for aPing message.

In:

ProtocolAck Returns
ProtocolNotSupported
HttpReturn

ProtocolAck:

0x4e

ProtocolNotSupported:

0x4f

Returns:

Return
Returns Return

Return:

ReturnData
PingAck

ReturnData:

0x51ReturnValue

PingAck:

0x53



CONTENTS |PREV |NEXT

[8]ページ先頭

©2009-2025 Movatter.jp