Interface BlockingDiscoveryProvider


public interface BlockingDiscoveryProvider
A blocking discovery provider. This interface should be implemented by discovery providers which are not capable of running asynchronously. The toDiscoveryProvider(Executor) method must be used to convert providers of this type to a type which can be used in a Discovery instance.
Author:
David M. Lloyd
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    discover(ServiceType serviceType, FilterSpec filterSpec, DiscoveryResult result)
    Attempt to discover implementations of a service synchronously.
    Convert this provider to a non-blocking provider which uses the given thread pool to dispatch discovery requests.
  • Method Details

    • discover

      void discover(ServiceType serviceType, FilterSpec filterSpec, DiscoveryResult result) throws InterruptedException
      Attempt to discover implementations of a service synchronously. Matches must be written to the DiscoveryResult.addMatch(ServiceURL) method on the result parameter as they are found. The DiscoveryResult.complete() method may be called when the discovery process is complete or has timed out or failed for any other reason. If the complete() method is not called, the discovery is assumed to be complete when the method returns.
      Parameters:
      serviceType - the service type to match
      filterSpec - the service attribute filter expression, or null to return all matches
      result - the discovery result
      Throws:
      InterruptedException - if discovery was interrupted for some reason
    • toDiscoveryProvider

      default DiscoveryProvider toDiscoveryProvider(Executor executor)
      Convert this provider to a non-blocking provider which uses the given thread pool to dispatch discovery requests. If the task is rejected by the executor, then discovery is immediately terminated. The task thread is interrupted if discovery is to be cancelled.
      Parameters:
      executor - the executor to use for task dispatch (must not be null)
      Returns:
      the provider (not null)