public class EC2MultiRegionAddressTranslater extends Object implements CloseableAddressTranslater
AddressTranslater 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:
| Constructor and Description |
|---|
EC2MultiRegionAddressTranslater() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called at
Cluster shutdown. |
InetSocketAddress |
translate(InetSocketAddress socketAddress)
Translates a Cassandra
rpc_address to another address if necessary. |
public InetSocketAddress translate(InetSocketAddress socketAddress)
AddressTranslaterrpc_address to another address if necessary.translate in interface AddressTranslatersocketAddress - 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 returing
address directly)public void close()
CloseableAddressTranslaterCluster shutdown.close in interface CloseableAddressTranslater