Package org.wildfly.discovery
Class Discovery
java.lang.Object
org.wildfly.discovery.Discovery
- All Implemented Interfaces:
org.wildfly.common.context.Contextual<Discovery>
public final class Discovery
extends Object
implements org.wildfly.common.context.Contextual<Discovery>
The service discovery API. Each discovery instance is associated with discovery providers which are able to
provide answers to discovery queries.
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionstatic Discoverycreate(DiscoveryProvider provider) Create a discovery object with the given single provider.static Discoverycreate(DiscoveryProvider... providers) Create a discovery object with the given providers.discover(ServiceDescription description) Perform a service discovery.discover(ServiceType serviceType, FilterSpec filterSpec) Perform a service discovery.discover(ServiceType serviceType, FilterSpec filterSpec, long timeout, TimeUnit timeUnit) Perform a service discovery.static org.wildfly.common.context.ContextManager<Discovery>Get the context manager.org.wildfly.common.context.ContextManager<Discovery>Get the instance context manager.voidprocessMissingTarget(URI location, Exception cause) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.common.context.Contextual
run, runAction, runBiConsumer, runBiFunction, runBiPredicate, runCallable, runConsumer, runExBiConsumer, runExBiFunction, runExBiPredicate, runExceptionAction, runExConsumer, runExFunction, runExIntFunction, runExLongFunction, runExPredicate, runFunction, runIntFunction, runLongFunction, runPredicate
-
Method Details
-
getInstanceContextManager
Get the instance context manager. Delegates togetContextManager().- Specified by:
getInstanceContextManagerin interfaceorg.wildfly.common.context.Contextual<Discovery>- Returns:
- the instance context manager (not
null)
-
getContextManager
Get the context manager.- Returns:
- the context manager (not
null)
-
discover
Perform a service discovery. The returned services queue is populated as discovery answers become available. Answers may be cached within each provider. The order of answers is not significant and can vary from call to call, especially with asynchronous discovery mechanisms. The returned service queue may be closed to indicate no further interest in query answers, and for this purpose it implementsAutoCloseablein order to facilitate simple usage in atry-with-resources block.- Parameters:
serviceType- the abstract or concrete type of service to search forfilterSpec- the service filter specification- Returns:
- the services queue
-
discover
public ServicesQueue discover(ServiceType serviceType, FilterSpec filterSpec, long timeout, TimeUnit timeUnit) Perform a service discovery. The returned services queue is populated as discovery answers become available. Answers may be cached within each provider. The order of answers is not significant and can vary from call to call, especially with asynchronous discovery mechanisms. The returned service queue may be closed to indicate no further interest in query answers, and for this purpose it implementsAutoCloseablein order to facilitate simple usage in atry-with-resources block. This method allows a timeout to be specified.- Parameters:
serviceType- the abstract or concrete type of service to search forfilterSpec- the service filter specificationtimeout- the timeout durationtimeUnit- the unit of time for the timeout- Returns:
- the services queue
-
discover
Perform a service discovery. The returned services queue is populated as discovery answers become available. Answers may be cached within each provider. The order of answers is not significant and can vary from call to call, especially with asynchronous discovery mechanisms. The returned service queue may be closed to indicate no further interest in query answers, and for this purpose it implementsAutoCloseablein order to facilitate simple usage in atry-with-resources block.- Parameters:
description- the service description (must not benull)- Returns:
- the services queue
-
processMissingTarget
-
create
Create a discovery object with the given providers. The givenprovidersargument and its array elements may not benull.- Parameters:
providers- the discovery providers (must not benull)- Returns:
- the discovery object
-
create
Create a discovery object with the given single provider. The givenproviderargument may not benull.- Parameters:
provider- the discovery provider (must not benull)- Returns:
- the discovery object
-