jupiter
2021-04-03 22:30:55 14 举报
jupiter
作者其他创作
大纲/内容
ServiceMetadata
private String group; // 服务组别 private String serviceProviderName; // 服务名称 private String version; // 服务版本号
AbstractDispatcher
JClient client;LoadBalancer loadBalancer;Serializer serializerImpl;ConsumerInterceptor[] interceptors;
ForkJoinPoolExecutorFactory
CloseableExecutor newExecutor();
LookupService
ServiceWrapper lookupService(Directory directory);
Registry
connectToRegistryServer
NettyConnector
NettyDomainConnector;NettyTcpConnector
JClient
withConnector(JConnector<JConnection> connector); RegistryService registryService();lookup(Directory directory)
重点
NettyTcpConnector
boolean isNative; // use native ChildConfig childConfig
①Nettyconnector 与 processor 的关系②nettyconnector包含processor使用其处理
DefaultRegistryService
1:n
JupiterRegistryServer
DefaultRegistry
ProviderProcessor
JNettyTcpConnector
The server of registration center
Transporter
Protocol protocol();
ProviderExecutors
CloseableExecutor executor;
包含如下代码
*appName. String appName();*网络层connector. JConnector<JConnection> connector();*设置网络层connector. JClient withConnector(JConnector<JConnection> connector); * 注册服务实例 RegistryService registryService();
DefaultRoundDispatcher
//单播方式派发消息
ProxyFactory
AsyncJupiterClient
The client of registration center.
把invoker和Connecto组合起来了
IntRhsPadding
Dispatcher
集成
默认客户端实现
继承
DefaultBroadcastDispatcher
//组播方式派发消息.
DefaultProviderProcessor
CloseableExecutor = executor
handleRequest();handleException();shutdown();doHandleException();
DefaultClient
// 服务订阅(SPI) RegistryService registryService; String appName; JConnector<JConnection> connector;
watchConnections(final Directory directory)
FailOverJupiterClient//测试进行代理调用等
ExecutorFactory
1:1
默认 registry service
IntSequence
DEFAULT_STEP;AtomicIntegerFieldUpdater<IntValue> updater;
NettyChannelGroup
int DEFAULT_SEQUENCE_STEP ;IntSequence sequence; //序号生成器ConcurrentLinkedQueue<Runnable> waitAvailableListeners; ChannelFutureListener remover;waitForAvailable();//****重要***//add(JChannel channel);JChannel next();
服务的元数据
JFilter
ClusterService syncService = ProxyFactory.factory(ClusterService.class) .version(\"1.0.0\") .client(client) .invokeType(InvokeType.SYNC) .clusterStrategy(ClusterInvoker.Strategy.FAIL_FAST) .newProxyInstance(); try { System.err.println(\"Sync result=\" + syncService.helloString()); } catch (Exception e) { e.printStackTrace(); }
JupiterRegistryServer类; * Client1 --> Server1AndClient2 --> Server2 * * 1. 先启动 JupiterRegistryServer * 2. 再启动 Server2 * 3. 接着启动 Server1AndClient2 * 4. 最后启动 Client1
JConnector
派发消息
FlowController
ControlResult flowControl(T t);
RegistryService registryService;String appName;
JClient
AbstractExecutorFactory
启动registerServer
DefaultRegistry//继承于connector
ClusterInvoker
ClusterInvoker//发起调用
FailFastClusterInvoker;FailOverClusterInvoker;FailSafeClusterInvoker
ConsumerProcessor
序号生成器
DefaultRegistryServer
0 条评论
下一页