diff --git a/src/main/java/com/couchbase/client/CouchbaseConnectionFactory.java b/src/main/java/com/couchbase/client/CouchbaseConnectionFactory.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/couchbase/client/CouchbaseConnectionFactory.java
+++ b/src/main/java/com/couchbase/client/CouchbaseConnectionFactory.java
@@ -444,17 +444,14 @@ public class CouchbaseConnectionFactory extends BinaryConnectionFactory {
           Thread.sleep(waitTime);
 
           ConfigurationProvider oldConfigProvider = getConfigurationProvider();
-
-          if (null != oldConfigProvider) {
-            oldConfigProvider.shutdown();
-          }
+          Reconfigurable oldRec = oldConfigProvider.getReconfigurable();
 
           ConfigurationProvider newConfigProvider =
             new ConfigurationProviderHTTP(storedBaseList, bucket, pass);
-          setConfigurationProvider(newConfigProvider);
+          newConfigProvider.subscribe(bucket, oldRec);
 
-          newConfigProvider.subscribe(bucket,
-            oldConfigProvider.getReconfigurable());
+          setConfigurationProvider(newConfigProvider);
+          oldConfigProvider.shutdown();
 
           if (!doingResubscribe.compareAndSet(true, false)) {
             LOGGER.log(Level.WARNING,
JCBC-<I>: Correctly reorder resubscriber to prevent race condition.

This changeset makes sure that the old reconfigurable is taken out
of the old provider before it gets shut down to avoid a situation
where it is null, leading to failures on subsequent reconnect
attempts.

Change-Id: I<I>ae5ecc<I>a<I>dbe5a8b9ca4f<I>be<I>
Reviewed-on: <URL>