Package org.apache.druid.rpc
Class FixedSetServiceLocator
- java.lang.Object
-
- org.apache.druid.rpc.FixedSetServiceLocator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ServiceLocator
public class FixedSetServiceLocator extends Object implements ServiceLocator
Basic implmentation ofServiceLocatorthat returns a service location from a static set of locations. Returns a random location each time one is requested.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static FixedSetServiceLocatorforDruidServerMetadata(Set<DruidServerMetadata> serverMetadataSet)static FixedSetServiceLocatorforServiceLocation(@NotNull ServiceLocation serviceLocation)com.google.common.util.concurrent.ListenableFuture<ServiceLocations>locate()Returns a future that resolves to a set ofServiceLocation.
-
-
-
Method Detail
-
forServiceLocation
public static FixedSetServiceLocator forServiceLocation(@NotNull @NotNull ServiceLocation serviceLocation)
-
forDruidServerMetadata
public static FixedSetServiceLocator forDruidServerMetadata(Set<DruidServerMetadata> serverMetadataSet)
-
locate
public com.google.common.util.concurrent.ListenableFuture<ServiceLocations> locate()
Description copied from interface:ServiceLocatorReturns a future that resolves to a set ofServiceLocation. If the returned object returns true fromServiceLocations.isClosed(), it means the service has closed permanently. Otherwise, any of the returned locations inServiceLocations.getLocations()is a viable selection. It is possible for the list of locations to be empty. This means that the service is not currently available, but also has not been closed, so it may become available at some point in the future.- Specified by:
locatein interfaceServiceLocator
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceServiceLocator
-
-