public class ZkConfigurationUpdateWatcher extends java.lang.Object implements ConfigurationUpdateWatcher
ConfigurationUpdateWatcher.UpdateableService| Constructor and Description |
|---|
ZkConfigurationUpdateWatcher() |
ZkConfigurationUpdateWatcher(ZooKeeperService zkService,
java.lang.String configType) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(ComponentContext context)
activate the service.
|
void |
checkConfigVersions()
compare cluster versions of configurations with local versions and update local deployment.
|
void |
configDeleted(java.lang.String configurationName)
Send delete notification, call on custom configuration remove.
|
void |
configLoadedOnStart(java.lang.String configurationName,
java.lang.String timestamp)
Initialize notification structure for configuration, call on initial load on service start.
|
void |
configUpdated(java.lang.String configurationName,
java.lang.String timestamp)
Send update notification, call on custom configuration creation or update.
|
void |
initialize()
connect to Zookeeper and create root node.
|
void |
process(WatchedEvent event)
reinstalls the watch and calls
checkConfigVersions(). |
void |
registerService(ConfigurationUpdateWatcher.UpdateableService service)
register a service to be notified on configuration updates.
|
void |
setZkService(ZooKeeperService zkService)
service reference bind method.
|
void |
startPolling()
start polling for updates.
|
void |
startPolling(int pollIntervalSeconds)
start polling for updates with custom interval.
|
boolean |
startWatching()
install a ZK watch on the root node to get notifications about changes.
|
void |
stopPolling()
stop polling for updates.
|
void |
stopWatching()
stop watching: ZK watch on root node will not be reinstalled.
|
void |
unsetZkService(ZooKeeperService zkService)
service reference unbind method.
|
public ZkConfigurationUpdateWatcher()
public ZkConfigurationUpdateWatcher(ZooKeeperService zkService, java.lang.String configType)
public void setZkService(ZooKeeperService zkService)
public void unsetZkService(ZooKeeperService zkService)
public void registerService(ConfigurationUpdateWatcher.UpdateableService service)
ConfigurationUpdateWatcherregisterService in interface ConfigurationUpdateWatcherprotected void activate(ComponentContext context)
public void initialize()
throws KeeperException
KeeperExceptionpublic boolean startWatching()
ConfigurationUpdateWatcherstartWatching in interface ConfigurationUpdateWatcherpublic void stopWatching()
ConfigurationUpdateWatcherstopWatching in interface ConfigurationUpdateWatcherpublic void startPolling()
ConfigurationUpdateWatcherstartPolling in interface ConfigurationUpdateWatcherpublic void startPolling(int pollIntervalSeconds)
ConfigurationUpdateWatcherstartPolling in interface ConfigurationUpdateWatcherpublic void stopPolling()
ConfigurationUpdateWatcherstopPolling in interface ConfigurationUpdateWatcherpublic void configLoadedOnStart(java.lang.String configurationName,
java.lang.String timestamp)
ConfigurationUpdateWatcherconfigLoadedOnStart in interface ConfigurationUpdateWatcherpublic void configUpdated(java.lang.String configurationName,
java.lang.String timestamp)
ConfigurationUpdateWatcherconfigUpdated in interface ConfigurationUpdateWatcherpublic void configDeleted(java.lang.String configurationName)
ConfigurationUpdateWatcherconfigDeleted in interface ConfigurationUpdateWatcherpublic void checkConfigVersions()
ConfigurationUpdateWatchercheckConfigVersions in interface ConfigurationUpdateWatcherpublic void process(WatchedEvent event)
checkConfigVersions().