Class ConnectionEndpoint
java.lang.Object
org.springframework.data.gemfire.support.ConnectionEndpoint
- All Implemented Interfaces:
Cloneable
,Comparable<ConnectionEndpoint>
The ConnectionEndpoint class models a GemFire connection endpoint in the format of hostname[portnumber],
where hostname is the network name or IP address of the host.
- Since:
- 1.6.3
- Author:
- John Blum, Jacob Barret
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConnectionEndpoint
(String host, int port) Constructs a ConnectionEndpoint initialized with the specific host and port. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
clone()
int
compareTo
(ConnectionEndpoint connectionEndpoint) boolean
static ConnectionEndpoint
from
(int port) Factory method used to construct a newConnectionEndpoint
with the givenport
listening on the default host.static ConnectionEndpoint
static ConnectionEndpoint
from
(InetSocketAddress socketAddress) Factory method used to convert the givenInetSocketAddress
into aConnectionEndpoint
.getHost()
Gets the host in this ConnectionEndpoint.int
getPort()
Gets the port number in this ConnectionEndpoint.int
hashCode()
static ConnectionEndpoint
Parses the host and port String value into a valid ConnectionEndpoint.static ConnectionEndpoint
Factory method used to parse thehost and port
value into a validConnectionEndpoint
.Converts thisConnectionEndpoint
into anInetSocketAddress
representation.toString()
-
Field Details
-
DEFAULT_PORT
protected static final int DEFAULT_PORT- See Also:
-
DEFAULT_HOST
- See Also:
-
GEMFIRE_HOST_PORT_SEPARATOR
- See Also:
-
STANDARD_HOST_PORT_SEPARATOR
- See Also:
-
-
Constructor Details
-
ConnectionEndpoint
Constructs a ConnectionEndpoint initialized with the specific host and port.- Parameters:
host
- the hostname or IP address of the ConnectionEndpoint. If the host is unspecified, then ConnectionEndpoint.DEFAULT_HOST will be used.port
- the (service) port number in this ConnectionEndpoint.- Throws:
IllegalArgumentException
- if the port number is less than 0.- See Also:
-
-
Method Details
-
from
Factory method used to construct a newConnectionEndpoint
with the givenport
listening on the default host.- Parameters:
port
-port
of theConnectionEndpoint
.- Returns:
- a new
ConnectionEndpoint
with the givenport
listening on the default host. - See Also:
-
from
- Parameters:
host
-host
of theConnectionEndpoint
.port
-port
of theConnectionEndpoint
.- Returns:
- a new
ConnectionEndpoint
with the givenhost
andport
.
-
from
Factory method used to convert the givenInetSocketAddress
into aConnectionEndpoint
.- Parameters:
socketAddress
-InetSocketAddress
used to construct, configure and initialize theConnectionEndpoint
.- Returns:
- a
ConnectionEndpoint
representing theInetSocketAddress
. - See Also:
-
parse
Parses the host and port String value into a valid ConnectionEndpoint.- Parameters:
hostPort
- a String value containing the host and port formatted as 'host[port]'.- Returns:
- a valid ConnectionEndpoint initialized with the host and port, or with DEFAULT_PORT if port was unspecified.
- See Also:
-
parse
Factory method used to parse thehost and port
value into a validConnectionEndpoint
.- Parameters:
hostPort
-String
containing the host and port formatted as host[port] or host:port.defaultPort
-Integer
indicating the default port to use if the port is unspecified in thehost and port
value.- Returns:
- a valid
ConnectionEndpoint
initialized with thehost and port
, or with the default port if port was unspecified. - See Also:
-
getHost
Gets the host in this ConnectionEndpoint.- Returns:
- a String value indicating the hostname or IP address in this ConnectionEndpoint.
-
getPort
public int getPort()Gets the port number in this ConnectionEndpoint.- Returns:
- an Integer value indicating the (service) port number in this ConnectionEndpoint.
-
toInetSocketAddress
Converts thisConnectionEndpoint
into anInetSocketAddress
representation.- Returns:
- an
InetSocketAddress
representation of thisConnectionEndpoint
. - See Also:
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ConnectionEndpoint>
-
equals
-
hashCode
public int hashCode() -
toString
-