Package com.networknt.registry.support
Class DirectRegistry
- java.lang.Object
-
- com.networknt.registry.support.DirectRegistry
-
- All Implemented Interfaces:
DiscoveryService
,Registry
,RegistryService
public class DirectRegistry extends Object
Direct registry is used for local testing only. It is implement all the interface of registry and discovery that is backed by local service.yml configuration. All instances of the service will be defined in the config as hard-coded url:port along with other parameters.- Author:
- axb, Steve Hu
-
-
Field Summary
Fields Modifier and Type Field Description protected String
registryClassName
-
Constructor Summary
Constructors Constructor Description DirectRegistry(URL url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
available(URL url)
set service status to available, so clients could use itList<URL>
discover(URL url)
protected void
doAvailable(URL url)
protected List<URL>
doDiscover(URL subscribeUrl)
protected void
doRegister(URL url)
protected void
doSubscribe(URL url, NotifyListener listener)
protected void
doUnavailable(URL url)
protected void
doUnregister(URL url)
protected void
doUnsubscribe(URL url, NotifyListener listener)
Collection<URL>
getRegisteredServiceUrls()
URL
getUrl()
protected void
notify(URL refUrl, NotifyListener listener, List<URL> urls)
void
register(URL url)
register service to registryvoid
subscribe(URL url, NotifyListener listener)
void
unavailable(URL url)
set service status to unavailable, client should not discover services of unavailable statevoid
unregister(URL url)
unregister service to registryvoid
unsubscribe(URL url, NotifyListener listener)
-
-
-
Field Detail
-
registryClassName
protected String registryClassName
-
-
Constructor Detail
-
DirectRegistry
public DirectRegistry(URL url)
-
-
Method Detail
-
doRegister
protected void doRegister(URL url)
-
doUnregister
protected void doUnregister(URL url)
-
doSubscribe
protected void doSubscribe(URL url, NotifyListener listener)
-
doUnsubscribe
protected void doUnsubscribe(URL url, NotifyListener listener)
-
doAvailable
protected void doAvailable(URL url)
-
doUnavailable
protected void doUnavailable(URL url)
-
register
public void register(URL url)
Description copied from interface:RegistryService
register service to registry- Specified by:
register
in interfaceRegistryService
- Parameters:
url
- a URL object
-
unregister
public void unregister(URL url)
Description copied from interface:RegistryService
unregister service to registry- Specified by:
unregister
in interfaceRegistryService
- Parameters:
url
- a URL object
-
subscribe
public void subscribe(URL url, NotifyListener listener)
- Specified by:
subscribe
in interfaceDiscoveryService
-
unsubscribe
public void unsubscribe(URL url, NotifyListener listener)
- Specified by:
unsubscribe
in interfaceDiscoveryService
-
discover
public List<URL> discover(URL url)
- Specified by:
discover
in interfaceDiscoveryService
-
getRegisteredServiceUrls
public Collection<URL> getRegisteredServiceUrls()
- Specified by:
getRegisteredServiceUrls
in interfaceRegistryService
-
available
public void available(URL url)
Description copied from interface:RegistryService
set service status to available, so clients could use it- Specified by:
available
in interfaceRegistryService
- Parameters:
url
- service url to be available, null means all services
-
unavailable
public void unavailable(URL url)
Description copied from interface:RegistryService
set service status to unavailable, client should not discover services of unavailable state- Specified by:
unavailable
in interfaceRegistryService
- Parameters:
url
- service url to be unavailable, null means all services
-
notify
protected void notify(URL refUrl, NotifyListener listener, List<URL> urls)
-
-