Class ZookeeperServiceWatch
java.lang.Object
org.springframework.cloud.zookeeper.discovery.ZookeeperServiceWatch
- All Implemented Interfaces:
EventListener,org.apache.curator.framework.recipes.cache.TreeCacheListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>
public class ZookeeperServiceWatch
extends Object
implements org.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>, org.apache.curator.framework.recipes.cache.TreeCacheListener, org.springframework.context.ApplicationEventPublisherAware
A
TreeCacheListener that sends HeartbeatEvent when an entry inside
Zookeeper has changed.- Since:
- 1.0.0
- Author:
- Spencer Gibb
-
Constructor Summary
ConstructorsConstructorDescriptionZookeeperServiceWatch(org.apache.curator.framework.CuratorFramework curator, ZookeeperDiscoveryProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionvoidchildEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.TreeCacheEvent event) org.apache.curator.framework.recipes.cache.TreeCachegetCache()voidonApplicationEvent(org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?> event) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher) voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
ZookeeperServiceWatch
public ZookeeperServiceWatch(org.apache.curator.framework.CuratorFramework curator, ZookeeperDiscoveryProperties properties)
-
-
Method Details
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
getCache
public org.apache.curator.framework.recipes.cache.TreeCache getCache() -
onApplicationEvent
public void onApplicationEvent(org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?> event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>
-
stop
- Throws:
Exception
-
childEvent
public void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.TreeCacheEvent event) throws Exception - Specified by:
childEventin interfaceorg.apache.curator.framework.recipes.cache.TreeCacheListener- Throws:
Exception
-