public abstract class AbstractRegistry extends Object implements Registry
Abstract registry。 对进出的url都进行createCopy保护,避免registry中的对象被修改,避免潜在的并发问题。
| Modifier and Type | Field and Description |
|---|---|
protected String |
registryClassName |
| Constructor and Description |
|---|
AbstractRegistry(URL url) |
| Modifier and Type | Method and Description |
|---|---|
void |
available(URL url)
set service status to available, so clients could use it
|
List<URL> |
discover(URL url) |
protected abstract void |
doAvailable(URL url) |
protected abstract List<URL> |
doDiscover(URL url) |
protected abstract void |
doRegister(URL url) |
protected abstract void |
doSubscribe(URL url,
NotifyListener listener) |
protected abstract void |
doUnavailable(URL url) |
protected abstract void |
doUnregister(URL url) |
protected abstract void |
doUnsubscribe(URL url,
NotifyListener listener) |
protected List<URL> |
getCachedUrls(URL url) |
Collection<URL> |
getRegisteredServiceUrls() |
URL |
getUrl() |
protected void |
notify(URL refUrl,
NotifyListener listener,
List<URL> urls) |
void |
register(URL url)
register service to registry
|
void |
subscribe(URL url,
NotifyListener listener) |
void |
unavailable(URL url)
set service status to unavailable, client should not discover services of unavailable state
|
void |
unregister(URL url)
unregister service to registry
|
void |
unsubscribe(URL url,
NotifyListener listener) |
protected String registryClassName
public AbstractRegistry(URL url)
public void register(URL url)
RegistryServiceregister in interface RegistryServicepublic void unregister(URL url)
RegistryServiceunregister in interface RegistryServicepublic void subscribe(URL url, NotifyListener listener)
subscribe in interface DiscoveryServicepublic void unsubscribe(URL url, NotifyListener listener)
unsubscribe in interface DiscoveryServicepublic List<URL> discover(URL url)
discover in interface DiscoveryServicepublic Collection<URL> getRegisteredServiceUrls()
getRegisteredServiceUrls in interface RegistryServicepublic void available(URL url)
RegistryServiceavailable in interface RegistryServiceurl - service url to be available, null means all servicespublic void unavailable(URL url)
RegistryServiceunavailable in interface RegistryServiceurl - service url to be unavailable, null means all servicesprotected void notify(URL refUrl, NotifyListener listener, List<URL> urls)
protected abstract void doRegister(URL url)
protected abstract void doUnregister(URL url)
protected abstract void doSubscribe(URL url, NotifyListener listener)
protected abstract void doUnsubscribe(URL url, NotifyListener listener)
protected abstract void doAvailable(URL url)
protected abstract void doUnavailable(URL url)
Copyright © 2020. All rights reserved.