datastax/spark-cassandra-connector — pull request #241 by rstrickland (2014-09-17 19:30:58+00:00)
Title: Added support for ignoring non-local nodes in the load balancer

In some multi-DC configurations it's advantageous to block port 9042 externally. This breaks the Java driver, since nodes in other DCs are set to HostDistance.REMOTE, which still causes the driver to try to connect to them when it receives an onAdd event. The result is a fatal exception.

This allows the user to set an optional config, spark.cassandra.connection.local_dc, which sets the HostDistance for all non-local DCs to IGNORED, thereby causing the Java driver to ignore them when they are discovered. This solution is similar to one I implemented in RingCache in the Cassandra-Hadoop integration, and solves the same problem.