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 Details

    • getInstanceContextManager

      public org.wildfly.common.context.ContextManager<Discovery> getInstanceContextManager()
      Get the instance context manager. Delegates to getContextManager().
      Specified by:
      getInstanceContextManager in interface org.wildfly.common.context.Contextual<Discovery>
      Returns:
      the instance context manager (not null)
    • getContextManager

      public static org.wildfly.common.context.ContextManager<Discovery> getContextManager()
      Get the context manager.
      Returns:
      the context manager (not null)
    • discover

      public ServicesQueue discover(ServiceType serviceType, FilterSpec filterSpec)
      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 implements AutoCloseable in order to facilitate simple usage in a try-with-resources block.
      Parameters:
      serviceType - the abstract or concrete type of service to search for
      filterSpec - 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 implements AutoCloseable in order to facilitate simple usage in a try-with-resources block. This method allows a timeout to be specified.
      Parameters:
      serviceType - the abstract or concrete type of service to search for
      filterSpec - the service filter specification
      timeout - the timeout duration
      timeUnit - the unit of time for the timeout
      Returns:
      the services queue
    • discover

      public ServicesQueue discover(ServiceDescription description)
      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 implements AutoCloseable in order to facilitate simple usage in a try-with-resources block.
      Parameters:
      description - the service description (must not be null)
      Returns:
      the services queue
    • processMissingTarget

      public void processMissingTarget(URI location, Exception cause)
    • create

      public static Discovery create(DiscoveryProvider... providers)
      Create a discovery object with the given providers. The given providers argument and its array elements may not be null.
      Parameters:
      providers - the discovery providers (must not be null)
      Returns:
      the discovery object
    • create

      public static Discovery create(DiscoveryProvider provider)
      Create a discovery object with the given single provider. The given provider argument may not be null.
      Parameters:
      provider - the discovery provider (must not be null)
      Returns:
      the discovery object