/**
* @param client curztor client
* @param path the full path to the node to cache
* @param dataIsCompressed if true, data in the path is compressed
*/publicNodeCache(CuratorFramework client, String path,boolean dataIsCompressed){
this.client = client.newWatcherRemoveCuratorFramework();this.path = PathUtils.validatePath(path);this.dataIsCompressed = dataIsCompressed;}
start() 启动缓存服务
publicvoidstart(boolean buildInitial)throws Exception
{
//设值启动状态
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED),"Cannot be started more than once");//增加连接状态监听 client.getConnectionStateListenable().addListener(connectionStateListener);// 进行初始化操作if( buildInitial ){
client.checkExists().creatingParentContainersIfNeeded().forPath(path);internalRebuild();}reset();}