Package org.apache.bookkeeper.net
Class BookieSocketAddress
java.lang.Object
org.apache.bookkeeper.net.BookieSocketAddress
This is a data wrapper class that is an InetSocketAddress, it would use the hostname
provided in constructors directly.
The string representation of a BookieSocketAddress is : <hostname>:<port>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BookieAddressResolverSimple converter from legacy BookieId to a real network address. -
Constructor Summary
ConstructorsConstructorDescriptionBookieSocketAddress(String addr) BookieSocketAddress(String hostname, int port) -
Method Summary
Modifier and TypeMethodDescriptionstatic BookieIdcreateDummyBookieIdForHostname(String hostname) Utility for Placement Policies that need to create a dummy BookieId that represents a given host.booleanintgetPort()inthashCode()static booleanisDummyBookieIdForHostname(BookieId bookieId) Tells whether a BookieId may be a dummy id.static BookieSocketAddressresolveLegacyBookieId(BookieId bookieId) Use legacy resolver to resolve a bookieId.Create a BookieID in legacy format hostname:port.toString()
-
Field Details
-
LEGACY_BOOKIEID_RESOLVER
Simple converter from legacy BookieId to a real network address.
-
-
Constructor Details
-
BookieSocketAddress
-
BookieSocketAddress
- Throws:
UnknownHostException
-
-
Method Details
-
getHostName
-
getPort
public int getPort() -
getSocketAddress
-
toString
-
equals
-
hashCode
public int hashCode() -
toBookieId
Create a BookieID in legacy format hostname:port.- Returns:
- the BookieID
-
createDummyBookieIdForHostname
Utility for Placement Policies that need to create a dummy BookieId that represents a given host.- Parameters:
hostname- the hostname- Returns:
- a dummy bookie id, compatible with the BookieSocketAddress#toBookieId, with a 0 tcp port.
-
isDummyBookieIdForHostname
Tells whether a BookieId may be a dummy id.- Parameters:
bookieId-- Returns:
- true if the BookieId looks like it has been generated by
createDummyBookieIdForHostname(java.lang.String)
-
resolveLegacyBookieId
public static BookieSocketAddress resolveLegacyBookieId(BookieId bookieId) throws BookieAddressResolver.BookieIdNotResolvedException Use legacy resolver to resolve a bookieId.- Parameters:
bookieId- legacy style bookie ID consisting of address (or hostname) and port- Returns:
- the BookieSocketAddress
- Throws:
BookieAddressResolver.BookieIdNotResolvedException
-