Package org.apache.dubbo.rpc.protocol
Class ProtocolSerializationWrapper
java.lang.Object
org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper
- All Implemented Interfaces:
Protocol
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ProtocolSerializationWrapper
-
-
Method Details
-
getDefaultPort
public int getDefaultPort()Description copied from interface:ProtocolGet default port when user doesn't config the port.- Specified by:
getDefaultPortin interfaceProtocol- Returns:
- default port
-
export
Description copied from interface:ProtocolExport service for remote invocation:
1. Protocol should record request source address after receive a request: RpcContext.getServerAttachment().setRemoteAddress();
2. export() must be idempotent, that is, there's no difference between invoking once and invoking twice when export the same URL
3. Invoker instance is passed in by the framework, protocol needs not to care- Specified by:
exportin interfaceProtocol- Type Parameters:
T- Service type- Parameters:
invoker- Service invoker- Returns:
- exporter reference for exported service, useful for unexport the service later
- Throws:
RpcException- thrown when error occurs during export the service, for example: port is occupied
-
refer
Description copied from interface:ProtocolRefer a remote service:
1. When user calls `invoke()` method of `Invoker` object which's returned from `refer()` call, the protocol needs to correspondingly execute `invoke()` method of `Invoker` object
2. It's protocol's responsibility to implement `Invoker` which's returned from `refer()`. Generally speaking, protocol sends remote request in the `Invoker` implementation.
3. When there's check=false set in URL, the implementation must not throw exception but try to recover when connection fails.- Specified by:
referin interfaceProtocol- Type Parameters:
T- Service type- Parameters:
type- Service classurl- URL address for the remote service- Returns:
- invoker service's local proxy
- Throws:
RpcException- when there's any error while connecting to the service provider
-
destroy
public void destroy()Description copied from interface:ProtocolDestroy protocol:
1. Cancel all services this protocol exports and refers
2. Release all occupied resources, for example: connection, port, etc.
3. Protocol can continue to export and refer new service even after it's destroyed. -
getServers
Description copied from interface:ProtocolGet all servers serving this protocol- Specified by:
getServersin interfaceProtocol- Returns:
-