Created
May 1, 2016 02:07
-
-
Save ChristopheSchmitz/5022edb008d78a45b994da5a0e93d76e to your computer and use it in GitHub Desktop.
sample-CassandraDriverAddressTranslater gist 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class PrivateToPublicAddressTranslater implements AddressTranslater { | |
final HashMap<InetSocketAddress, InetSocketAddress> privatePublicAddressMap = new HashMap<InetSocketAddress, InetSocketAddress>(); | |
{ | |
privatePublicAddressMap.put(new InetSocketAddress("10.224.0.134", 9042), new InetSocketAddress("50.16.170.131", 9042)); | |
privatePublicAddressMap.put(new InetSocketAddress("10.224.89.62", 9042), new InetSocketAddress("52.202.55.67", 9042)); | |
privatePublicAddressMap.put(new InetSocketAddress("10.224.133.143", 9042), new InetSocketAddress("52.202.11.232", 9042)); | |
} | |
public InetSocketAddress translate(final InetSocketAddress inetSocketAddress) { | |
return privatePublicAddressMap.get(inetSocketAddress); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gist used for blogpost on how to use AddressTranslater