[ Pobierz całość w formacie PDF ] .Chapter 9: RMI Wire Protocol Page 739The multiplexing protocol facilitates the use of virtual connections, which arethemselves bidirectional, reliable byte streams, representing a particularsession between two endpoints.The set of virtual connections between twoendpoints over a single concrete connection comprises a multiplexed connection.Using the multiplexing protocol, virtual connections can be opened and closedby either endpoint.The state of an virtual connection with respect to a givenendpoint is defined by the elements of the multiplexing protocol that are sentand received over the concrete connection.Such state involves if theconnection is open or closed, the actual data that has been transmitted across,and the related flow control mechanisms.If not otherwise qualified, the termconnection used in the remainder of this section means virtual connection.A virtual connections within a given multiplexed connection is identified by a16 bit integer, known as the connection identifier.Thus, there exist 65,536possible virtual connections in one multiplexed connection.Theimplementation may limit the number of these virtual connections that may beused simultaneously.9.6.2 Connection State and Flow ControlConnections are manipulated using the various operations defined by themultiplexing protocol.The following are the names of the operations definedby the protocol: OPEN, CLOSE, CLOSEACK, REQUEST, and TRANSMIT.Theexact format and rules for all the operations are detailed in Section 9.6.3, Protocol Format.The OPEN, CLOSE, and CLOSEACK operations control connections becomingopened and closed, while the REQUEST and TRANSMIT operations are usedto transmit data across an open connection within the constraints of the flowcontrol mechanism.Connection StatesA virtual connection is open with respect to a particular endpoint if theendpoint has sent an OPEN operation for that connection, or it has received anOPEN operation for that connection (and it had not been subsequently closed).The various protocol operations are described below.A virtual connection is pending close with respect to a particular endpoint if theendpoint has sent a CLOSE operation for that connection, but it has not yetreceived a subsequent CLOSE or CLOSEACK operation for that connection.Page 74 Java"! Remote Method Invocation Specification JDK 1.1 FCS, February 10, 19979A virtual connection is closed with respect to a particular endpoint if it hasnever been opened, or if it has received a CLOSE or a CLOSEACK operationfor that connection (and it has not been subsequently opened).Flow ControlThe multiplexing protocol using a simple packeting flow control mechanism toallow multiple virtual connections to exist in parallel over the same concreteconnection.The high level requirement of the flow control mechanism is thatthe state of all virtual connections is independent; the state of one connectionmay not affect the behavior of others.For example, if the data buffers handlingdata coming in from one connection become full, this cannot prevent thetransmission and processing of data for any other connection.This is necessaryif the proceedings of one connection is dependent on the completion of the useof another connection, such as would happen with recursive RMI calls.Therefore, the practical implication is that the implementation must always beable to consume and process all of the multiplexing protocol data ready forinput on the concrete connection (assuming that it conforms to thisspecification).Each endpoint has two state values associated with each connection: howmany bytes of data the endpoint has requested but not received (input requestcount) and how many bytes the other endpoint has requested but have notbeen supplied by this endpoint (output request count).An endpoint s output request count is increased when it receives a REQUESToperation from the other endpoint, and it is decreased when it sends aTRANSMIT operation.An endpoint s input request count is increased when itsends a REQUEST operation, and it is decreased when it receives a TRANSMIToperation.It is a protocol violation if either of these values becomes negative.It is a protocol violation for an endpoint to send a REQUEST operation thatwould increase its input request count to more bytes that it can currentlyhandle without blocking.It should, however, make sure that its input requestcount is greater than zero if the user of the connection is waiting to read data.It is a protocol violation for an endpoint to send a TRANSMIT operationcontaining more bytes that its output request count.It may buffer outgoingdata until the user of the connection requests that data written to theconnection be explicitly flushed.If data must be sent over the connection,Chapter 9: RMI Wire Protocol Page 759however, by either an explicit flush or because the implementation s outputbuffers are full, then the user of the connection may be blocked until sufficientTRANSMIT operations can proceed.Beyond the rules outlined above, implementations are free to send REQUESTand TRANSMIT operations as deemed appropriate.For example, an endpointmay request more data for a connection even if its input buffer is not empty.9.6.3 Protocol FormatThe byte stream format of the multiplexing protocol consists of a contiguousseries of variable length records.The first byte of the record is an operationcode that identifies the operation of the record and determines the format ofthe rest of its content.The following legal operation codes are defined:value name0xE1 OPEN0xE2 CLOSE0xE3 CLOSEACK0xE4 REQUEST0xE5 TRANSMITIt is a protocol violation if the first byte of a record is not one of the definedoperation codes.The following sections describe the format of the records foreach operation code
[ Pobierz całość w formacie PDF ] zanotowane.pldoc.pisz.plpdf.pisz.plmikr.xlx.pl
|