Package org.wildfly.discovery.spi
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 TypeMethodDescriptionvoiddiscover(ServiceType serviceType, FilterSpec filterSpec, DiscoveryResult result) Attempt to discover implementations of a service synchronously.default DiscoveryProvidertoDiscoveryProvider(Executor executor) 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 theDiscoveryResult.addMatch(ServiceURL)method on theresultparameter as they are found. TheDiscoveryResult.complete()method may be called when the discovery process is complete or has timed out or failed for any other reason. If thecomplete()method is not called, the discovery is assumed to be complete when the method returns.- Parameters:
serviceType- the service type to matchfilterSpec- the service attribute filter expression, ornullto return all matchesresult- the discovery result- Throws:
InterruptedException- if discovery was interrupted for some reason
-
toDiscoveryProvider
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 benull)- Returns:
- the provider (not
null)
-