Package org.apache.dubbo.rpc.support
Class MockProtocol
java.lang.Object
org.apache.dubbo.rpc.protocol.AbstractProtocol
org.apache.dubbo.rpc.support.MockProtocol
- All Implemented Interfaces:
ScopeModelAware,Protocol
MockProtocol is used for generating a mock invoker by URL and type on consumer side
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Exporter<T> Export service for remote invocation:
1.intGet default port when user doesn't config the port.<T> Invoker<T> protocolBindingRefer(Class<T> type, URL url) Methods inherited from class org.apache.dubbo.rpc.protocol.AbstractProtocol
destroy, getExporterMap, getExporters, getServers, refer, setFrameworkModelMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.rpc.model.ScopeModelAware
setApplicationModel, setModuleModel, setScopeModel
-
Constructor Details
-
MockProtocol
public MockProtocol()
-
-
Method Details
-
getDefaultPort
public int getDefaultPort()Description copied from interface:ProtocolGet default port when user doesn't config the port.- 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- 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
-
protocolBindingRefer
- Throws:
RpcException
-