public Config getVBucketConfig() {
   Bucket config = configurationProvider.getBucketConfiguration(bucket);
   if (config == null) {
     throw new ConfigurationException(
         "Could not fetch valid configuration " + "from provided nodes. Stopping.");
   } else if (config.isNotUpdating()) {
     LOGGER.warning(
         "Noticed bucket configuration to be disconnected, " + "will attempt to reconnect");
     setConfigurationProvider(new ConfigurationProviderHTTP(storedBaseList, bucket, pass));
   }
   return configurationProvider.getBucketConfiguration(bucket).getConfig();
 }
 @Override
 public AuthDescriptor getAuthDescriptor() {
   if (!configurationProvider.getAnonymousAuthBucket().equals(bucket) && bucket != null) {
     return new AuthDescriptor(new String[] {}, new PlainCallbackHandler(bucket, pass));
   } else {
     return null;
   }
 }
    public void run() {
      String threadNameBase = "Couchbase/Resubscriber (Status: ";
      Thread.currentThread().setName(threadNameBase + "running)");
      LOGGER.log(
          Level.CONFIG,
          "Resubscribing for {0} using base list {1}",
          new Object[] {bucket, storedBaseList});

      long reconnectAttempt = 0;
      long backoffTime = 1000;
      long maxWaitTime = 10000;
      do {
        try {
          long waitTime = (reconnectAttempt++) * backoffTime;
          if (reconnectAttempt >= 10) {
            waitTime = maxWaitTime;
          }
          LOGGER.log(
              Level.INFO,
              "Reconnect attempt {0}, waiting {1}ms",
              new Object[] {reconnectAttempt, waitTime});
          Thread.sleep(waitTime);

          ConfigurationProvider oldConfigProvider = getConfigurationProvider();

          if (null != oldConfigProvider) {
            oldConfigProvider.shutdown();
          }

          ConfigurationProvider newConfigProvider =
              new ConfigurationProviderHTTP(storedBaseList, bucket, pass);
          setConfigurationProvider(newConfigProvider);

          newConfigProvider.subscribe(bucket, oldConfigProvider.getReconfigurable());

          if (!doingResubscribe.compareAndSet(true, false)) {
            LOGGER.log(Level.WARNING, "Could not reset from doing a resubscribe.");
          }
        } catch (Exception ex) {
          LOGGER.log(Level.WARNING, "Resubscribe attempt failed: ", ex);
        }
      } while (doingResubscribe.get());

      Thread.currentThread().setName(threadNameBase + "complete)");
    }
 protected void requestConfigReconnect(String bucketName, Reconfigurable rec) {
   configurationProvider.markForResubscribe(bucketName, rec);
   needsReconnect = true;
 }