use of org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade in project qpid-broker-j by apache.
the class BDBHAVirtualHostNodeImpl method postSetDesignatedPrimary.
// used as post action by field _designatedPrimary
@SuppressWarnings("unused")
private void postSetDesignatedPrimary() {
ReplicatedEnvironmentFacade environmentFacade = getReplicatedEnvironmentFacade();
if (environmentFacade != null) {
resolveFuture(environmentFacade.reapplyDesignatedPrimary(), "Change designated primary did not complete within " + MUTATE_JE_TIMEOUT_MS + "ms. New value " + _designatedPrimary + " will become effective once the JE task thread is free.", "Failed to set designated primary to value " + _designatedPrimary + " on " + this);
getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED(String.valueOf(_designatedPrimary)));
}
}
use of org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade in project qpid-broker-j by apache.
the class BDBHAVirtualHostNodeImpl method postSetPriority.
// used as post action by field _priority
@SuppressWarnings("unused")
private void postSetPriority() {
ReplicatedEnvironmentFacade environmentFacade = getReplicatedEnvironmentFacade();
if (environmentFacade != null) {
resolveFuture(environmentFacade.reapplyPriority(), "Change node priority did not complete within " + MUTATE_JE_TIMEOUT_MS + "ms. New value " + _priority + " will become effective once the JE task thread is free.", "Failed to set priority node to value " + _priority + " on " + this);
getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.PRIORITY_CHANGED(String.valueOf(_priority)));
}
}
use of org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade in project qpid-broker-j by apache.
the class BDBHAVirtualHostImpl method onOpen.
@Override
public void onOpen() {
ReplicatedEnvironmentFacade facade = getReplicatedEnvironmentFacade();
if (facade != null) {
facade.setMessageStoreDurability(SyncPolicy.valueOf(getLocalTransactionSynchronizationPolicy()), SyncPolicy.valueOf(getRemoteTransactionSynchronizationPolicy()), ReplicatedEnvironmentFacade.REPLICA_REPLICA_ACKNOWLEDGMENT_POLICY);
}
super.onOpen();
}
use of org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade in project qpid-broker-j by apache.
the class BDBHAVirtualHostNodeImpl method postSetRole.
// used as post action by field _role
@SuppressWarnings("unused")
private void postSetRole() {
ReplicatedEnvironmentFacade environmentFacade = getReplicatedEnvironmentFacade();
if (environmentFacade != null) {
getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.TRANSFER_MASTER(getName(), getAddress()));
resolveFuture(environmentFacade.transferMasterToSelfAsynchronously(), "Transfer master did not complete within " + MUTATE_JE_TIMEOUT_MS + "ms. Node may still be elected master at a later time.", "Failed to transfer master to " + this);
} else {
// Ignored
}
}
use of org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade in project qpid-broker-j by apache.
the class BDBHAVirtualHostNodeImpl method activate.
@Override
protected ListenableFuture<Void> activate() {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Activating virtualhost node " + this);
}
// activating the environment does not cause a state change. Adjust the role
// so that our observers will see WAITING rather than our previous role in the group.
// the role will change again after the election at which point it will become master or replica.
_lastRole.set(NodeRole.WAITING);
attributeSet(ROLE, _role, NodeRole.WAITING);
getConfigurationStore().init(this);
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CREATED());
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(getStorePath()));
ReplicatedEnvironmentFacade environmentFacade = (ReplicatedEnvironmentFacade) getConfigurationStore().getEnvironmentFacade();
if (environmentFacade == null) {
throw new IllegalStateException("Environment facade is not created");
}
try {
Set<ReplicationNode> remoteNodes = environmentFacade.getNodes();
for (ReplicationNode node : remoteNodes) {
String nodeAddress = node.getHostName() + ":" + node.getPort();
if (!_permittedNodes.contains(nodeAddress)) {
getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), nodeAddress));
shutdownOnIntruder(nodeAddress);
throw new IllegalStateException("Intruder node detected: " + nodeAddress);
}
}
} catch (DatabaseException dbe) {
environmentFacade.handleDatabaseException("DB exception while checking for intruder node", dbe);
}
if (_environmentFacade.compareAndSet(null, environmentFacade)) {
environmentFacade.setStateChangeListener(new EnvironmentStateChangeListener());
environmentFacade.setReplicationGroupListener(new RemoteNodesDiscoverer());
environmentFacade.setPermittedNodes(_permittedNodes);
}
return Futures.immediateFuture(null);
}
Aggregations