zkDesign
2018-05-17 15:40:21 10 举报
为你推荐
查看更多
抱歉,暂无相关内容
Zookeeper源码说明
作者其他创作
大纲/内容
注册一个监视器,根据returnCode(rc)注册监视器,getWatches,由其实现者实现
返回对响应事件(event)的监视器集合
Code[Enum]
Code(int)+ intValue():int+ static getCode(int):Code
WatchedEvent[Class]
- keeperState:KeeperState- eventType:EventType- path:String
ClientWatchManager[Interface]
KeeperState[Enum]
+ Disconnected (0)+ SyncConnected (3)+ AuthFailed (4)+ ConnectedReadOnly (5)+ SaslAuthenticated(6)+ Expired (-112)
- KeeperState(int)
StaticHostProvider
- serverAddresses:List- lastIndex:int-currentIndex:int
+StaticHostProvider(List )+ size():Int+ next():InetSocketAddress+ onConnected():void
ClientCnxn
- SET_WATCHES_MAX_LENGTH- disableAutoWatchReset
ReplyHeader
- xid:int- zxid:int- err:int
...
HostProvider
+ size():int+ next(long):InetSocketAddress+ onConnected():void
用于管理客户端的Socket I/O
获取可供连接的zookeeper服务
Status[Enum]
+ isAlive():boolean+ isConnected():boolean
ChildWatchRegistration
+ override getWatches(int):void
Packet
requestHeader :RequestHeaderreplyHeader:ReplyHeaderrequest:Recordresponse:Recordbb:ByteBufferclientPath:StringserverPath:Stringfinished:booleancb:AsyncCallbackctx:ObjectwatchRegistration:WatchRegistration
+ operation1(params):returnType- operation2(params)- operation3()
Watcher[Interface]
+ process(WatchedEvent)
当 type为None时,返回并清空所维护的监视器(Watch);NodeCreated时,返回并移除dataWatches existWatches该路径下的监视器(Watch);NodeChildrenChanged时,返回并移除childWatches该路径下的监视器(Watch);NodeDeleted时,返回并移除dataWatches,childWatches该路径下的监视器(Watch),只删除existWatches,不返回;
DataWatchRegistration
Event[Interface]
RequestHeader
- xid:int- type:int
ExistsWatchRegistration
+ override getWatches(int):void+ override shouldAddWatch(int):boolean
WatchRegistration[Class]
- watcher:Watcher- clientPath:String
EventType[Enum]
+ None (-1)+ NodeCreated (1)+ NodeDeleted (2)+ NodeDataChanged (3)+ NodeChildrenChanged (4)
- EventType(int)
Zookeeper
- watchManager:ZKWatchManager- cnxn:ClientCnxn
ZKWatchManager[Class]
0 条评论
回复 删除
下一页