@Override public void sync(String path, Object context) { Preconditions.checkState(isStarted(), "instance must be started before calling this method"); path = fixForNamespace(path); internalSync(this, path, context); }
private void validateConnection(CuratorEvent curatorEvent) { if (curatorEvent.getType() == CuratorEventType.WATCHED) { if (curatorEvent.getWatchedEvent().getState() == Watcher.Event.KeeperState.Disconnected) { connectionStateManager.addStateChange(ConnectionState.SUSPENDED); internalSync( this, "/", null); // we appear to have disconnected, force a new ZK event and see if we can connect // to another server } else if (curatorEvent.getWatchedEvent().getState() == Watcher.Event.KeeperState.Expired) { connectionStateManager.addStateChange(ConnectionState.LOST); } else if (curatorEvent.getWatchedEvent().getState() == Watcher.Event.KeeperState.SyncConnected) { connectionStateManager.addStateChange(ConnectionState.RECONNECTED); } else if (curatorEvent.getWatchedEvent().getState() == Watcher.Event.KeeperState.ConnectedReadOnly) { connectionStateManager.addStateChange(ConnectionState.READ_ONLY); } } }