This is the default way a ZooKeeper connector will obtain the HOST:IP port of the ZooKeeper coordinator(master) node.
This is the default way a ZooKeeper connector will obtain the HOST:IP port of the ZooKeeper coordinator(master) node. The phantom testing utilities are capable of auto-generating a ZooKeeper instance if none is found running.
A test instance is ephemeral with zero persistence, it will get created, populated and deleted once per test run. Upon creation, the test instance will propagate the IP:PORT combo it found available to an environment variable. By convention that variable is TEST_ZOOKEEPER_CONNECTOR.
This method will try to read that variable and parse an java.net.InetSocketAddress
from it.
If the environment variable is null or an InetSocketAddress cannot be parsed from it, the ZooKeeper default, localhost:2181 will be used.
The InetSocketAddress of the ZooKeeper master node.
This will initialise the Cassandra cluster connection based on the ZooKeeper connector settings.
This will initialise the Cassandra cluster connection based on the ZooKeeper connector settings. It will connector to ZooKeeper, fetch the Cassandra sequence of HOST:IP pairs, and create a cluster + session for the mix.
Interestingly enough binding to a port with a simple java.
Interestingly enough binding to a port with a simple java.net.Socket or java.net.ServerSocket to check if a local ZooKeeper exists is not enough in this day and age. We take a slightly different approach, by performing a single check when the default address is initialised. We spawn an actual ZooKeeper Client using the finagle-zookeeper integration and attempt to connect. If the initial ping is successful, we conclude a ZooKeeper is found. Otherwise, we conclude it doesn't exist.
At present times the Phantom connectors are not capable of monitoring for state change system wide, e.g a move from a local ZooKeeper to an embedded and so on, therefore this check can be done a single time, as any major state change in the system with regards to ZooKeeper going down would not affect existing Cassandra connections and any failure in a Cassandra node is handled by the Datastax driver.