Package org.wildfly.discovery.impl
Class LocalRegistryAndDiscoveryProvider
java.lang.Object
org.wildfly.discovery.impl.LocalRegistryAndDiscoveryProvider
- All Implemented Interfaces:
DiscoveryProvider,RegistryProvider
public final class LocalRegistryAndDiscoveryProvider
extends Object
implements RegistryProvider, DiscoveryProvider
A local in-memory service registry and discovery provider. Services registered with this provider can be subsequently
discovered. Since all operations happen in-memory, the discovery provider always completes immediately.
- Author:
- David M. Lloyd
-
Field Summary
Fields inherited from interface org.wildfly.discovery.spi.DiscoveryProvider
EMPTYFields inherited from interface org.wildfly.discovery.spi.RegistryProvider
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiscover(ServiceType serviceType, FilterSpec filterSpec, DiscoveryResult result) Attempt to discover implementations of a service.registerService(ServiceURL serviceURL) Register a service with this provider.registerServices(ServiceURL... serviceURLs) Register multiple services with this provider at once.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.discovery.spi.DiscoveryProvider
processMissingTarget
-
Constructor Details
-
LocalRegistryAndDiscoveryProvider
public LocalRegistryAndDiscoveryProvider()
-
-
Method Details
-
registerService
Description copied from interface:RegistryProviderRegister a service with this provider. Service URLs which are unsupported must be ignored; in this case, the empty registration handle must be returned.- Specified by:
registerServicein interfaceRegistryProvider- Parameters:
serviceURL- the service to register (notnull)- Returns:
- the service registration handle (must not be
null)
-
registerServices
Description copied from interface:RegistryProviderRegister multiple services with this provider at once. Service URLs which are unsupported must be ignored. If none of the service URLs are supported, then the empty registration handle must be returned.The default implementation calls
RegistryProvider.registerService(ServiceURL)for each service in the array and returns an aggregated handle.- Specified by:
registerServicesin interfaceRegistryProvider- Parameters:
serviceURLs- the services to register (notnull, will not containnullelements)- Returns:
- the service registration handle (must not be
null)
-
discover
public DiscoveryRequest discover(ServiceType serviceType, FilterSpec filterSpec, DiscoveryResult result) Description copied from interface:DiscoveryProviderAttempt to discover implementations of a service. Matches must be written to theDiscoveryResult.addMatch(ServiceURL)method on theresultparameter as they are found. TheDiscoveryResult.complete()method must be called when the discovery process is complete or has timed out or failed for any other reason, otherwise discovery clients may hang indefinitely.The discovery process should be asynchronous if possible. In this case, this method should return as soon as possible in order to unblock the calling thread quickly and allow other discovery mechanisms to proceed. The discovery process will not be considered complete until the result's completion method is called, even if such a call comes from a different thread.
- Specified by:
discoverin interfaceDiscoveryProvider- Parameters:
serviceType- the service type to matchfilterSpec- the service attribute filter expression, ornullto return all matchesresult- the discovery result
-