|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.ServerName
public class ServerName
Instance of an HBase ServerName.
A server name is used uniquely identifying a server instance and is made
of the combination of hostname, port, and startcode. The startcode
distingushes restarted servers on same hostname and port (startcode is
usually timestamp of server startup). The toString()
format of
ServerName is safe to use in the filesystem and as znode name up in
ZooKeeper. Its format is:
<hostname> '
.
For example, if hostname is SERVERNAME_SEPARATOR
' <port> 'SERVERNAME_SEPARATOR
' <startcode>example.org
, port is 1234
,
and the startcode for the regionserver is 1212121212
, then
the toString()
would be example.org,1234,1212121212
.
You can obtain a versioned serialized form of this class by calling
getVersionedBytes()
. To deserialize, call parseVersionedServerName(byte[])
Immutable.
Field Summary | |
---|---|
static int |
NON_STARTCODE
What to use if no startcode supplied. |
static Pattern |
SERVERNAME_PATTERN
|
static String |
SERVERNAME_SEPARATOR
This character is used as separator between server hostname, port and startcode. |
Constructor Summary | |
---|---|
ServerName(String serverName)
|
|
ServerName(String hostname,
int port,
long startcode)
|
|
ServerName(String hostAndPort,
long startCode)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NON_STARTCODE
public static final String SERVERNAME_SEPARATOR
public static Pattern SERVERNAME_PATTERN
Constructor Detail |
---|
public ServerName(String hostname, int port, long startcode)
public ServerName(String serverName)
public ServerName(String hostAndPort, long startCode)
Method Detail |
---|
public static String parseHostname(String serverName)
public static int parsePort(String serverName)
public static long parseStartcode(String serverName)
public String toString()
toString
in class Object
public byte[] getVersionedBytes()
getServerName()
as bytes with a short-sized prefix with
the ServerName#VERSION of this class.public String getServerName()
public String getHostname()
public int getPort()
public long getStartcode()
public static String getServerName(String hostName, int port, long startcode)
hostName
- port
- startcode
-
<hostname> ',' <port> ',' <startcode>
public static String getServerName(String hostAndPort, long startcode)
hostAndPort
- String in form of <hostname> ':' <port>startcode
-
<hostname> ',' <port> ',' <startcode>
public String getHostAndPort()
Addressing.createHostAndPortStr(String, int)
public static long getServerStartcodeFromServerName(String serverName)
serverName
- ServerName in form specified by getServerName()
servername
public static String getServerNameLessStartCode(String inServerName)
inServerName
- full server name
public int compareTo(ServerName other)
compareTo
in interface Comparable<ServerName>
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public static ServerName findServerWithSameHostnamePort(Collection<ServerName> names, ServerName serverName)
public static boolean isSameHostnameAndPort(ServerName left, ServerName right)
left
- right
-
other
has same hostname and port.public static ServerName parseVersionedServerName(byte[] versionedBytes)
ServerName
from bytes
gotten from a call to getVersionedBytes()
. Will take care of the
case where bytes were written by an earlier version of hbase.
versionedBytes
- Pass bytes gotten from a call to getVersionedBytes()
getVersionedBytes()
public static ServerName parseServerName(String str)
str
- Either an instance of toString()
or a
"'
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |