Skip to content

Commit

Permalink
GEODE-7196 Simplify ClusterDistributionManage
Browse files Browse the repository at this point in the history
remove distribution ID collections from ClusterDistributionManager

move Executors out of DistributionManager implementations

make membership views immutable - we shouldn't install a new view
and then modify it because it's now used directly by other code.
  • Loading branch information
bschuchardt committed Sep 26, 2019
1 parent a951681 commit 24faeea
Show file tree
Hide file tree
Showing 105 changed files with 1,479 additions and 1,459 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.apache.geode.distributed.internal.DistributionMessage;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.MessageWithReply;
import org.apache.geode.distributed.internal.OperationExecutors;
import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.distributed.internal.ReplyMessage;
import org.apache.geode.distributed.internal.SerialAckedMessage;
Expand Down Expand Up @@ -430,7 +431,7 @@ public int getProcessorId() {

@Override
public int getProcessorType() {
return ClusterDistributionManager.SERIAL_EXECUTOR;
return OperationExecutors.SERIAL_EXECUTOR;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
import static org.apache.geode.distributed.internal.ClusterDistributionManager.NORMAL_DM_TYPE;
import static org.apache.geode.distributed.internal.ClusterDistributionManager.SERIAL_EXECUTOR;
import static org.apache.geode.distributed.internal.DistributionConfig.DEFAULT_ACK_WAIT_THRESHOLD;
import static org.apache.geode.distributed.internal.OperationExecutors.SERIAL_EXECUTOR;
import static org.apache.geode.internal.AvailablePort.MULTICAST;
import static org.apache.geode.internal.AvailablePort.SOCKET;
import static org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
Expand Down Expand Up @@ -137,18 +137,19 @@ public void testWaitForDeparture() throws Exception {
(ClusterDistributionManager) system.getDistributionManager();
final FakeMessage message = new FakeMessage(null);

distributionManager.getExecutor(SERIAL_EXECUTOR, member).execute(new SizeableRunnable(100) {
distributionManager.getExecutors().getExecutor(SERIAL_EXECUTOR, member)
.execute(new SizeableRunnable(100) {

@Override
public void run() { // always throws NullPointerException
message.doAction(distributionManager, false);
}
@Override
public void run() { // always throws NullPointerException
message.doAction(distributionManager, false);
}

@Override
public String toString() {
return "Processing fake message";
}
});
@Override
public String toString() {
return "Processing fake message";
}
});

Assert.assertTrue("expected the serial queue to be flushed",
distributionManager.getMembershipManager().waitForDeparture(member));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;

import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_AUTO_RECONNECT;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
Expand Down Expand Up @@ -185,6 +186,7 @@ private Properties createLocatorConfig() {
config.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
config.setProperty(ENABLE_NETWORK_PARTITION_DETECTION, "false");
config.setProperty(USE_CLUSTER_CONFIGURATION, "false");
config.setProperty(DISABLE_AUTO_RECONNECT, "true");
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import static org.apache.geode.cache.RegionShortcut.REPLICATE;
import static org.apache.geode.cache.client.ClientRegionShortcut.PROXY;
import static org.apache.geode.distributed.internal.ClusterDistributionManager.MAX_FE_THREADS;
import static org.apache.geode.distributed.internal.DistributionConfig.GEMFIRE_PREFIX;
import static org.apache.geode.distributed.internal.OperationExecutors.MAX_FE_THREADS;
import static org.apache.geode.test.dunit.VM.getHostName;
import static org.apache.geode.test.dunit.VM.getVM;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public void missingDiskStoreCanBeRevokedBeforeStartingServer() throws Exception

// This should fail with a revocation failed message
try (IgnoredException ie = addIgnoredException(RevokeFailedException.class)) {
vm2.invoke(() -> {
vm2.invoke("revoke disk store should fail", () -> {
assertThatThrownBy(() -> {
DistributedSystemConfig config = defineDistributedSystem(getSystem(), "");
AdminDistributedSystem adminDS = getDistributedSystem(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ void awaitNotification(final long timeout, final TimeUnit unit) {

void awaitWithoutNotification(final long timeout, final TimeUnit unit) {
try {
awaitNotification(timeout, unit);
await().atMost(timeout, unit).until(() -> notified.get());
} catch (ConditionTimeoutException expected) {
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void testReplyProcessorInitiatesSuspicion() throws Exception {
when(dm.getCancelCriterion()).thenReturn(stopper);
when(dm.getMembershipManager()).thenReturn(manager);
when(dm.getViewMembers()).thenReturn(members);
when(dm.getDistributionManagerIds()).thenReturn(new HashSet(members));
when(dm.getDistributionManagerIds()).thenReturn(new HashSet<>(members));
when(dm.addMembershipListenerAndGetDistributionManagerIds(any(
org.apache.geode.distributed.internal.MembershipListener.class)))
.thenReturn(new HashSet(members));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.geode.admin.ManagedEntityConfig;
import org.apache.geode.admin.SystemMemberType;
import org.apache.geode.annotations.internal.MakeNotStatic;
import org.apache.geode.distributed.internal.ClusterDistributionManager;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.internal.admin.GemFireVM;
import org.apache.geode.internal.admin.remote.RemoteApplicationVM;
Expand Down Expand Up @@ -117,7 +116,7 @@ public boolean isRunning() {
return false;
}
}
return ((ClusterDistributionManager) dm).getDistributionManagerIdsIncludingAdmin()
return dm.getDistributionManagerIdsIncludingAdmin()
.contains(getDistributedMember());
}

Expand Down
Loading

0 comments on commit 24faeea

Please sign in to comment.