You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2014/08/10 22:51:36 UTC

svn commit: r1617158 - /qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java

Author: kwall
Date: Sun Aug 10 20:51:35 2014
New Revision: 1617158

URL: http://svn.apache.org/r1617158
Log:
QPID-5983: [Java Broker] BDB HA: Reset role to DETACHED when BDB HA VHN is stopped.

Modified:
    qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java

Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java?rev=1617158&r1=1617157&r2=1617158&view=diff
==============================================================================
--- qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java (original)
+++ qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java Sun Aug 10 20:51:35 2014
@@ -71,7 +71,6 @@ import org.apache.qpid.server.store.berk
 import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacadeFactory;
 import org.apache.qpid.server.store.berkeleydb.replication.ReplicationGroupListener;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
-import org.apache.qpid.server.virtualhost.berkeleydb.BDBHAVirtualHost;
 import org.apache.qpid.server.virtualhost.berkeleydb.BDBHAVirtualHostImpl;
 import org.apache.qpid.server.virtualhostnode.AbstractVirtualHostNode;
 import org.codehaus.jackson.map.ObjectMapper;
@@ -324,7 +323,13 @@ public class BDBHAVirtualHostNodeImpl ex
         }
         finally
         {
-            stopEnvironment();
+            closeEnvironment();
+
+            // closing the environment does not cause a state change.  Adjust the role
+            // so that our observers will see DETACHED rather than our previous role in the group.
+            ReplicatedEnvironment.State detached = ReplicatedEnvironment.State.DETACHED;
+            _lastReplicatedEnvironmentState.set(detached);
+            attributeSet(ROLE, _role, detached);
 
             //Perhaps, having STOPPED operational logging could be sufficient. However, on START we still will be seeing 2 logs: ATTACHED and STARTED
             getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DETACHED(getName(), getGroupName()));
@@ -345,7 +350,7 @@ public class BDBHAVirtualHostNodeImpl ex
         }
     }
 
-    private void stopEnvironment()
+    private void closeEnvironment()
     {
         ReplicatedEnvironmentFacade environmentFacade = getReplicatedEnvironmentFacade();
         if (environmentFacade != null && _environmentFacade.compareAndSet(environmentFacade, null))
@@ -412,7 +417,7 @@ public class BDBHAVirtualHostNodeImpl ex
         }
         finally
         {
-            stopEnvironment();
+            closeEnvironment();
             getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DETACHED(getName(), getGroupName()));
         }
     }
@@ -909,7 +914,7 @@ public class BDBHAVirtualHostNodeImpl ex
                             }
                             finally
                             {
-                                stopEnvironment();
+                                closeEnvironment();
                             }
                             notifyStateChanged(state, State.ERRORED);
                         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org