Package org.apache.druid.rpc
Class ServiceLocation
java.lang.Object
org.apache.druid.rpc.ServiceLocation
Represents a service location at a particular point in time.
-
Constructor Summary
ConstructorsConstructorDescriptionServiceLocation(String host, int plaintextPort, int tlsPort, String basePath) Create a service location. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ServiceLocationfromDruidNode(DruidNode druidNode) Create a service location based on aDruidNode, without a base path.static ServiceLocationfromDruidServerMetadata(DruidServerMetadata druidServerMetadata) Create a service location based on aDruidServerMetadata.static ServiceLocationCreate a service location based on aURI.getHost()Returns a host:port string for the preferred port (TLS if available; plaintext otherwise).intintinthashCode()toString()withBasePath(String newBasePath)
-
Constructor Details
-
ServiceLocation
Create a service location.- Parameters:
host- hostname or addressplaintextPort- plaintext porttlsPort- TLS portbasePath- base path; must be encoded and must not include trailing "/". In particular, to use root as the base path, pass "" for this parameter.
-
-
Method Details
-
fromDruidNode
Create a service location based on aDruidNode, without a base path. -
fromUri
Create a service location based on aURI.- Throws:
IllegalArgumentException- if the URI cannot be mapped to a service location.
-
fromDruidServerMetadata
Create a service location based on aDruidServerMetadata.- Throws:
IllegalArgumentException- if the server metadata cannot be mapped to a service location.
-
getHost
-
getHostAndPort
Returns a host:port string for the preferred port (TLS if available; plaintext otherwise). -
getPlaintextPort
public int getPlaintextPort() -
getTlsPort
public int getTlsPort() -
getBasePath
-
withBasePath
-
toURL
-
equals
-
hashCode
public int hashCode() -
toString
-