srpc的UMl图
时间: 2023-07-23 12:15:34 浏览: 30
以下是SRPC的简化UML类图:
```
+------------------+ +------------------+
| Client | | Server |
+------------------+ +------------------+
| - transport: Transport | - transport: Transport
| - proxyObjects: Map<String, Object> | - serviceObjects: Map<String, Object>
| | - register(interface, impl)
| + call(interface, method, args) | - call(interface, method, args)
| |
+------------------+ +------------------+
| |
| |
+------------------+ +------------------+
| ProxyObject | | ServiceObject |
+------------------+ +------------------+
| - transport: Transport | - impl: Object
| - interfaceName: String | - interfaceName: String
| | - methodName: String
| + invokeMethod(args) | + invokeMethod(args)
| |
+------------------+ +------------------+
| |
| |
+------------------+ +------------------+
| Transport | | Transport |
+------------------+ +------------------+
| - host: String | - host: String
| - port: int | - port: int
| |
| + connect() | + listen()
| + close() | + close()
| + send(data) | + send(data)
| + receive() | + receive()
+------------------+ +------------------+
```
其中,`Client`是客户端类,包含了`Transport`对象和`ProxyObject`对象,用于调用远程方法。`Server`是服务端类,包含了`Transport`对象和`ServiceObject`对象,用于注册接口和提供服务。`ProxyObject`和`ServiceObject`都是代理对象,分别封装了客户端和服务端的实现细节。`Transport`是传输层类,封装了底层的网络通信细节,用于数据的传输和连接的管理。