public class ZooKeeperServiceImpl extends java.lang.Object implements ZooKeeperService
BUNDLE_ID| Constructor and Description |
|---|
ZooKeeperServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(ComponentContext context)
OSGi Declarative Services service activation method.
|
void |
closeClient()
close the client quietly.
|
protected void |
deactivate(ComponentContext context)
OSGi Declarative Services service deactivation method.
|
ZooKeeper |
getClient()
get zookeeper client, create if it doesn't exist.
|
long |
getFailSafetyLevel() |
AnyMap |
getServerState() |
boolean |
isOperational() |
void |
process(WatchedEvent event)
we only use Watches for zookeeper client state change events.
|
void |
registerWatcher(Watcher watcher)
register a watcher for ZooKeeper events.
|
void |
setClusterConfigService(ClusterConfigService clusterConfigService)
set new ClusterConfigService.
|
void |
setEnvironmentInfo(EnvironmentInfo environmentInfo)
set new EnvironmentInfo.
|
void |
unregisterWatcher(Watcher watcher)
unregister a watcher for ZooKeeper events.
|
void |
unsetClusterConfigService(ClusterConfigService clusterConfigService)
remove a ClusterConfigService.
|
void |
unsetEnvironmentInfo(EnvironmentInfo environmentInfo)
remove a EnvironmentInfo.
|
void |
waitForClientConnected()
wait until the zookeeper client is (re)connected.
|
public ZooKeeper getClient()
throws java.io.IOException,
ClusterConfigException
getClient in interface ZooKeeperServicejava.io.IOException - error creating clientClusterConfigException - if the cluster configuration cannot be readpublic void closeClient()
closeClient in interface ZooKeeperServicepublic long getFailSafetyLevel()
getFailSafetyLevel in interface ZooKeeperServiceprotected void activate(ComponentContext context)
context - OSGi service component context.protected void deactivate(ComponentContext context)
context - OSGi service component context.public void setClusterConfigService(ClusterConfigService clusterConfigService)
clusterConfigService - new ClusterConfigServicepublic void unsetClusterConfigService(ClusterConfigService clusterConfigService)
public void setEnvironmentInfo(EnvironmentInfo environmentInfo)
clusterConfigService - new ClusterConfigServicepublic void unsetEnvironmentInfo(EnvironmentInfo environmentInfo)
public void waitForClientConnected()
ZooKeeperServicewaitForClientConnected in interface ZooKeeperServicepublic void process(WatchedEvent event)
public void registerWatcher(Watcher watcher)
registerWatcher in interface ZooKeeperServicepublic void unregisterWatcher(Watcher watcher)
unregisterWatcher in interface ZooKeeperServicepublic AnyMap getServerState()
getServerState in interface ZooKeeperServicepublic boolean isOperational()
isOperational in interface ZooKeeperService