code: public void registerNodeStateListener(NodeStateListener listener)
      {
          stateCheck(State.CREATED, State.RUNNING, State.SHUTTING_DOWN, State.QUEUING);
          try
          {
              stateListeners.add(listener);
              nodeListLock.readLock().lock();
              for (RiakNode node : nodeList)
              {
                  node.addStateListener(listener);
                  listener.nodeStateChanged(node, node.getNodeState());
              }
          }
          finally
          {
              nodeListLock.readLock().unlock();
          }
      }
docs: Register a NodeStateListener.
  <p>
  Any state change by any of the nodes in the cluster will be sent to
  the registered NodeStateListener.
  </p>
  <p>When registering, the current state of all the nodes is sent to the
  listener.
  </p>
  @param listener The NodeStateListener to register.