summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore/src
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-07-08 21:40:01 +0000
committerKeith Wall <kwall@apache.org>2014-07-08 21:40:01 +0000
commit790ce3196c5cef5a138bae29fa7ac9f03fee5b1b (patch)
treead4141bcb804a4662c93a1ee50ef69a6578447fe /qpid/java/bdbstore/src
parentfc1519a03845766cedf3154e4db97ee307cbbf06 (diff)
downloadqpid-python-790ce3196c5cef5a138bae29fa7ac9f03fee5b1b.tar.gz
QPID-5885: [Java Broker] Virtualhostnode to replace real virtualhost with replica virtualhost in the event that the BDB HA goes into detached state
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1608956 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore/src')
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java17
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java22
2 files changed, 13 insertions, 26 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
index 8b9039c792..f8b9636c5d 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
@@ -846,23 +846,6 @@ public class ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChan
{
try
{
- if (environment.isValid())
- {
- environment.setStateChangeListener(new StateChangeListener()
- {
- @Override
- public void stateChange(StateChangeEvent stateChangeEvent) throws RuntimeException
- {
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug(
- "When restarting a state change event is received on NOOP listener for state:"
- + stateChangeEvent.getState());
- }
- }
- });
- }
-
try
{
closeSequences();
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
index 3868025096..0bbbff0f98 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
@@ -46,7 +46,6 @@ import com.sleepycat.je.rep.utilint.HostPortPair;
import org.apache.log4j.Logger;
import org.apache.qpid.server.configuration.updater.Task;
-import org.apache.qpid.server.configuration.updater.VoidTask;
import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.BrokerModel;
@@ -104,6 +103,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu
@ManagedAttributeField(afterSet="postSetPriority")
private int _priority;
+
@ManagedAttributeField(afterSet="postSetQuorumOverride")
private int _quorumOverride;
@@ -426,11 +426,22 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu
private void onReplica()
{
+ createReplicaVirtualHost();
+ }
+
+
+ private void onDetached()
+ {
+ createReplicaVirtualHost();
+ }
+
+ private void createReplicaVirtualHost()
+ {
try
{
closeVirtualHostIfExist();
- Map<String, Object> hostAttributes = new HashMap<String, Object>();
+ Map<String, Object> hostAttributes = new HashMap<>();
hostAttributes.put(VirtualHost.MODEL_VERSION, BrokerModel.MODEL_VERSION);
hostAttributes.put(VirtualHost.NAME, getGroupName());
hostAttributes.put(VirtualHost.TYPE, "BDB_HA_REPLICA");
@@ -442,11 +453,6 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu
}
}
- private void onDetached()
- {
- closeVirtualHostIfExist();
- }
-
protected void closeVirtualHostIfExist()
{
VirtualHost<?,?,?> virtualHost = getVirtualHost();
@@ -478,11 +484,9 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu
onReplica();
break;
case DETACHED:
- LOGGER.error("BDB replicated node in detached state, therefore passivating.");
onDetached();
break;
case UNKNOWN:
- LOGGER.warn("BDB replicated node in unknown state (hopefully temporarily)");
break;
default:
LOGGER.error("Unexpected state change: " + state);