Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toList;
import static org.apache.geode.internal.lang.SystemUtils.isWindows;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.SoftAssertions.assertSoftly;
import static org.awaitility.Awaitility.waitAtMost;
import static org.junit.Assume.assumeFalse;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -100,10 +98,6 @@ public void before() throws Exception {

@Test
public void testLocalBeans_MaintainServerAndCrashLocator() {
// TODO: Currently failing on windows and causing CI job to hang.
// TODO: Ignoring these until they are fixed.
assumeFalse(isWindows());

List<String> initialServerBeans = canonicalBeanNamesFor(server1);

locator1.forceDisconnect();
Expand All @@ -123,10 +117,6 @@ public void testLocalBeans_MaintainServerAndCrashLocator() {

@Test
public void testLocalBeans_MaintainLocatorAndCrashServer() {
// TODO: Currently failing on windows and causing CI job to hang.
// TODO: Ignoring these until they are fixed.
assumeFalse(isWindows());

List<String> initialLocatorBeans = canonicalBeanNamesFor(locator1);

server1.forceDisconnect();
Expand All @@ -147,10 +137,6 @@ public void testLocalBeans_MaintainLocatorAndCrashServer() {

@Test
public void testRemoteBeanKnowledge_MaintainServerAndCrashLocator() throws IOException {
// TODO: Currently failing on windows and causing CI job to hang.
// TODO: Ignoring these until they are fixed.
assumeFalse(isWindows());

List<ObjectName> initialLocator1GemfireBeans =
getFederatedGemfireBeansFrom(locator1);
List<ObjectName> initialLocator2GemfireBeans =
Expand Down Expand Up @@ -189,10 +175,6 @@ public void testRemoteBeanKnowledge_MaintainServerAndCrashLocator() throws IOExc
@Test
public void testRemoteBeanKnowledge_MaintainLocatorAndCrashServer()
throws IOException {
// TODO: Currently failing on windows and causing CI job to hang.
// TODO: Ignoring these until they are fixed.
assumeFalse(isWindows());

List<ObjectName> initialLocator1GemfireBeans =
getFederatedGemfireBeansFrom(locator1);
List<ObjectName> initialLocator2GemfireBeans =
Expand All @@ -201,7 +183,7 @@ public void testRemoteBeanKnowledge_MaintainLocatorAndCrashServer()
assertThat(initialLocator1GemfireBeans)
.containsExactlyElementsOf(initialLocator2GemfireBeans);

server1.forceDisconnect();
server1.forceDisconnect(2000);

List<ObjectName> intermediateLocator1GemfireBeans =
getFederatedGemfireBeansFrom(locator1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static java.util.concurrent.TimeUnit.SECONDS;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -88,6 +89,39 @@ public void forceDisconnect() {
vm.invoke("force disconnect", () -> ClusterStartupRule.memberStarter.forceDisconnectMember());
}

/**
* This disconnects the distributed system of the member. The reconnect thread will wait for at
* least the given delay before completing the attempt.
*
* @param delayReconnecting minimum delay in milliseconds before reconnect can complete.
*/
public void forceDisconnect(final long delayReconnecting) {
vm.invoke(() -> {
// The reconnect thread can yield the CPU before allowing the listeners to be invoked. The
// latch ensures that the listener is guaranteed to be called before this method returns thus
// ensuring that reconnection has started but not yet completed.
CountDownLatch latch = new CountDownLatch(1);
InternalDistributedSystem.addReconnectListener(
new InternalDistributedSystem.ReconnectListener() {
@Override
public void reconnecting(InternalDistributedSystem oldSystem) {
try {
Thread.sleep(delayReconnecting);
latch.countDown();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

@Override
public void onReconnect(InternalDistributedSystem oldSystem,
InternalDistributedSystem newSystem) {}
});
ClusterStartupRule.memberStarter.forceDisconnectMember();
latch.await();
});
}

public void waitTilLocatorFullyReconnected() {
vm.invoke(() -> {
try {
Expand Down