Java Code Examples for org.apache.cassandra.config.DatabaseDescriptor#getServerEncryptionOptions()

The following examples show how to use org.apache.cassandra.config.DatabaseDescriptor#getServerEncryptionOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutboundTcpConnectionPool.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
public static boolean isEncryptedChannel(InetAddress address)
{
    IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
    switch (DatabaseDescriptor.getServerEncryptionOptions().internode_encryption)
    {
        case none:
            return false; // if nothing needs to be encrypted then return immediately.
        case all:
            break;
        case dc:
            if (snitch.getDatacenter(address).equals(snitch.getDatacenter(FBUtilities.getBroadcastAddress())))
                return false;
            break;
        case rack:
            // for rack then check if the DC's are the same.
            if (snitch.getRack(address).equals(snitch.getRack(FBUtilities.getBroadcastAddress()))
                    && snitch.getDatacenter(address).equals(snitch.getDatacenter(FBUtilities.getBroadcastAddress())))
                return false;
            break;
    }
    return true;
}