public class EC2MultiRegionAddressTranslator extends Object implements AddressTranslator
AddressTranslator implementation for a multi-region EC2 deployment where clients are
also deployed in EC2.
Its distinctive feature is that it translates addresses according to the location of the Cassandra host:
Implementation note: this class performs a reverse DNS lookup of the origin address, to find the domain name of the target instance. Then it performs a forward DNS lookup of the domain name; the EC2 DNS does the private/public switch automatically based on location.
| Constructor and Description |
|---|
EC2MultiRegionAddressTranslator() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called at
Cluster shutdown. |
void |
init(Cluster cluster)
Initializes this address translator.
|
InetSocketAddress |
translate(InetSocketAddress socketAddress)
Translates a Cassandra
rpc_address to another address if necessary. |
public void init(Cluster cluster)
AddressTranslatorinit in interface AddressTranslatorcluster - the Cluster instance for which the translator is created.public InetSocketAddress translate(InetSocketAddress socketAddress)
AddressTranslatorrpc_address to another address if necessary.translate in interface AddressTranslatorsocketAddress - the address of a node as returned by Cassandra. Note that if the rpc_address of a node has been configured to 0.0.0.0 server side, then the
provided address will be the node listen_address, *not* 0.0.0.0. Also note
that the port for InetSocketAddress will always be the one set at Cluster
construction time (9042 by default).address. If the return is null, then address will be used by the driver
(it is thus equivalent to returning address directly)public void close()
AddressTranslatorCluster shutdown.close in interface AddressTranslatorCopyright © 2012–2023. All rights reserved.