ARTEMIS-1737 fix for inaccessible slave console after failover
This commit is contained in:
parent
27a4a1dfc5
commit
dc096f950d
|
@ -432,6 +432,8 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
|
||||
void fail(boolean failoverOnServerShutdown) throws Exception;
|
||||
|
||||
void backToBackup(boolean failoverOnServerShutdown) throws Exception;
|
||||
|
||||
Queue updateQueue(String name,
|
||||
RoutingType routingType,
|
||||
Integer maxConsumers,
|
||||
|
@ -472,6 +474,8 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
|
||||
void addExternalComponent(ActiveMQComponent externalComponent);
|
||||
|
||||
List<ActiveMQComponent> getExternalComponents();
|
||||
|
||||
boolean addClientConnection(String clientId, boolean unique);
|
||||
|
||||
void removeClientConnection(String clientId);
|
||||
|
|
|
@ -915,6 +915,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
stop(failoverOnServerShutdown, false, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void backToBackup(boolean failoverOnServerShutdown) throws Exception {
|
||||
stop(failoverOnServerShutdown, false, false, false);
|
||||
}
|
||||
|
||||
public final void stop(boolean failoverOnServerShutdown, boolean isExit) throws Exception {
|
||||
stop(failoverOnServerShutdown, false, false, isExit);
|
||||
}
|
||||
|
@ -3124,4 +3129,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
public Set<ActivateCallback> getActivateCallbacks() {
|
||||
return activateCallbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActiveMQComponent> getExternalComponents() {
|
||||
return externalComponents;
|
||||
}
|
||||
}
|
|
@ -187,7 +187,7 @@ public class SharedNothingLiveActivation extends LiveActivation {
|
|||
clusterConnection.addClusterTopologyListener(listener1);
|
||||
if (listener1.waitForBackup()) {
|
||||
//if we have to many backups kept or are not configured to restart just stop, otherwise restart as a backup
|
||||
activeMQServer.fail(true);
|
||||
activeMQServer.backToBackup(true);
|
||||
ActiveMQServerLogger.LOGGER.restartingReplicatedBackupAfterFailback();
|
||||
// activeMQServer.moveServerData(replicatedPolicy.getReplicaPolicy().getMaxSavedReplicatedJournalsSize());
|
||||
activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy());
|
||||
|
|
|
@ -275,6 +275,12 @@
|
|||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- DB Test Deps -->
|
||||
<dependency>
|
||||
|
|
|
@ -16,12 +16,17 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.tests.integration.cluster.failover;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.client.ClientSession;
|
||||
import org.apache.activemq.artemis.component.WebServerComponent;
|
||||
import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
|
||||
import org.apache.activemq.artemis.core.server.ServiceComponent;
|
||||
import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
|
||||
import org.apache.activemq.artemis.dto.AppDTO;
|
||||
import org.apache.activemq.artemis.dto.WebServerDTO;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
@ -125,6 +130,27 @@ public class ReplicatedFailoverTest extends FailoverTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplicatedFailbackBackupFromLiveBackToBackup() throws Exception {
|
||||
WebServerDTO wdto = new WebServerDTO();
|
||||
AppDTO appDTO = new AppDTO();
|
||||
appDTO.war = "console.war";
|
||||
appDTO.url = "console";
|
||||
wdto.apps = new ArrayList<AppDTO>();
|
||||
wdto.apps.add(appDTO);
|
||||
wdto.bind = "http://localhost:0";
|
||||
wdto.path = "console";
|
||||
WebServerComponent webServerComponent = new WebServerComponent();
|
||||
webServerComponent.configure(wdto, ".", ".");
|
||||
webServerComponent.start();
|
||||
|
||||
backupServer.getServer().addExternalComponent(webServerComponent);
|
||||
// this is called when backup servers go from live back to backup
|
||||
backupServer.getServer().backToBackup(true);
|
||||
assertTrue(backupServer.getServer().getExternalComponents().get(0).isStarted());
|
||||
((ServiceComponent)(backupServer.getServer().getExternalComponents().get(0))).stop(true);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void createConfigs() throws Exception {
|
||||
createReplicatedConfigs();
|
||||
|
|
Loading…
Reference in New Issue