com.alipay.remoting.rpc.protocol
Class RpcProtocolV2

java.lang.Object
  extended by com.alipay.remoting.rpc.protocol.RpcProtocolV2
All Implemented Interfaces:
Protocol

public class RpcProtocolV2
extends Object
implements Protocol

Request command protocol for v2 0 1 2 4 6 8 10 11 12 14 16 +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------+-----+-----+-----+-----+ |proto| ver1|type | cmdcode |ver2 | requestId |codec|switch| timeout | +-----------+-----------+-----------+-----------+-----------+------------+-----------+-----------+ |classLen |headerLen |contentLen | ... | +-----------+-----------+-----------+-----------+ + | className + header + content bytes | + + | ... ... | CRC32(optional) | +------------------------------------------------------------------------------------------------+ proto: code for protocol ver1: version for protocol type: request/response/request oneway cmdcode: code for remoting command ver2:version for remoting command requestId: id of request codec: code for codec switch: function switch for protocol headerLen: length of header contentLen: length of content CRC32: CRC32 of the frame(Exists when ver1 > 1) Response command protocol for v2 0 1 2 3 4 6 8 10 11 12 14 16 +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------+-----+-----+-----+-----+ |proto| ver1| type| cmdcode |ver2 | requestId |codec|switch|respstatus | classLen | +-----------+-----------+-----------+-----------+-----------+------------+-----------+-----------+ |headerLen | contentLen | ... | +-----------------------------------+ + | className + header + content bytes | + + | ... ... | CRC32(optional) | +------------------------------------------------------------------------------------------------+ respstatus: response status


Field Summary
static byte PROTOCOL_CODE
           
static byte PROTOCOL_VERSION_1
          version 1, is the same with RpcProtocol
static byte PROTOCOL_VERSION_2
          version 2, is the protocol version for RpcProtocolV2
 
Constructor Summary
RpcProtocolV2()
           
 
Method Summary
 CommandFactory getCommandFactory()
          Get the command factory for the protocol.
 CommandHandler getCommandHandler()
          Get the command handler for the protocol.
 CommandDecoder getDecoder()
          Get the decoder for the protocol.
 CommandEncoder getEncoder()
          Get the encoder for the protocol.
 HeartbeatTrigger getHeartbeatTrigger()
          Get the heartbeat trigger for the protocol.
static int getRequestHeaderLength()
           
static int getResponseHeaderLength()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_CODE

public static final byte PROTOCOL_CODE
See Also:
Constant Field Values

PROTOCOL_VERSION_1

public static final byte PROTOCOL_VERSION_1
version 1, is the same with RpcProtocol

See Also:
Constant Field Values

PROTOCOL_VERSION_2

public static final byte PROTOCOL_VERSION_2
version 2, is the protocol version for RpcProtocolV2

See Also:
Constant Field Values
Constructor Detail

RpcProtocolV2

public RpcProtocolV2()
Method Detail

getRequestHeaderLength

public static int getRequestHeaderLength()

getResponseHeaderLength

public static int getResponseHeaderLength()

getEncoder

public CommandEncoder getEncoder()
Description copied from interface: Protocol
Get the encoder for the protocol.

Specified by:
getEncoder in interface Protocol
Returns:

getDecoder

public CommandDecoder getDecoder()
Description copied from interface: Protocol
Get the decoder for the protocol.

Specified by:
getDecoder in interface Protocol
Returns:

getHeartbeatTrigger

public HeartbeatTrigger getHeartbeatTrigger()
Description copied from interface: Protocol
Get the heartbeat trigger for the protocol.

Specified by:
getHeartbeatTrigger in interface Protocol
Returns:

getCommandHandler

public CommandHandler getCommandHandler()
Description copied from interface: Protocol
Get the command handler for the protocol.

Specified by:
getCommandHandler in interface Protocol
Returns:

getCommandFactory

public CommandFactory getCommandFactory()
Description copied from interface: Protocol
Get the command factory for the protocol.

Specified by:
getCommandFactory in interface Protocol
Returns:


Copyright © 2018. All rights reserved.