/**
  * This method is called when there is a topology change in the cluster.
  *
  * <p>This method is intended for internal use only.
  */
 public void reconfigure(Bucket bucket) {
   reconfiguring = true;
   if (bucket.isNotUpdating()) {
     getLogger()
         .info(
             "Bucket configuration is disconnected from cluster "
                 + "configuration updates, attempting to reconnect.");
     CouchbaseConnectionFactory cbcf = (CouchbaseConnectionFactory) connFactory;
     cbcf.requestConfigReconnect(cbcf.getBucketName(), this);
   }
   try {
     vconn.reconfigure(bucket);
     if (mconn instanceof CouchbaseConnection) {
       CouchbaseConnection cbConn = (CouchbaseConnection) mconn;
       cbConn.reconfigure(bucket);
     } else {
       CouchbaseMemcachedConnection cbMConn = (CouchbaseMemcachedConnection) mconn;
       cbMConn.reconfigure(bucket);
     }
   } catch (IllegalArgumentException ex) {
     getLogger()
         .warn("Failed to reconfigure client, staying with " + "previous configuration.", ex);
   } finally {
     reconfiguring = false;
   }
 }
  /**
   * Get a CouchbaseClient based on the REST response from a Couchbase server where the username is
   * different than the bucket name.
   *
   * <p>Note that when specifying a ConnectionFactory you must specify a BinaryConnectionFactory.
   * Also the ConnectionFactory's protocol and locator values are always overwritten. The protocol
   * will always be binary and the locator will be chosen based on the bucket type you are
   * connecting to.
   *
   * <p>To connect to the "default" special bucket for a given cluster, use an empty string as the
   * password.
   *
   * <p>If a password has not been assigned to the bucket, it is typically an empty string.
   *
   * <p>The subscribe variable is determines whether or not we will subscribe to the configuration
   * changes feed. This constructor should be used when calling super from subclasses of
   * CouchbaseClient since the subclass might want to start the changes feed later.
   *
   * @param cf the ConnectionFactory to use to create connections
   * @throws IOException if connections could not be made
   * @throws ConfigurationException if the configuration provided by the server has issues or is not
   *     compatible
   */
  public CouchbaseClient(CouchbaseConnectionFactory cf) throws IOException {
    super(cf, AddrUtil.getAddresses(cf.getVBucketConfig().getServers()));
    List<InetSocketAddress> addrs =
        AddrUtil.getAddressesFromURL(cf.getVBucketConfig().getCouchServers());

    getLogger().info(MODE_ERROR);
    vconn = cf.createViewConnection(addrs);
    cf.getConfigurationProvider().subscribe(cf.getBucketName(), this);
  }