Skip to content

Commit

Permalink
GEODE-870: Handling multiple concurrent locator restarts. Elder locat…
Browse files Browse the repository at this point in the history
…or nomination
  • Loading branch information
Udo Kohlmeyer committed Feb 29, 2016
1 parent 34beda8 commit edc1c4c
Show file tree
Hide file tree
Showing 9 changed files with 352 additions and 370 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gemstone.gemfire.distributed.internal.membership.gms.membership;

import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;

public class GMSJoinLeaveHelper {
public static boolean isViewCreator() {
GMSJoinLeave gmsJoinLeave = getGmsJoinLeave();
if (gmsJoinLeave != null) {
GMSJoinLeave.ViewCreator viewCreator = gmsJoinLeave.getViewCreator();
if (viewCreator != null && !viewCreator.isShutdown()) {
return true;
} else {
return false;
}
}
throw new RuntimeException("This should not have happened. There should be a JoinLeave for every DS");
}

private static GMSJoinLeave getGmsJoinLeave() {
InternalDistributedSystem distributedSystem = getInternalDistributedSystem();
DM dm = distributedSystem.getDM();
GMSMembershipManager membershipManager = (GMSMembershipManager) dm.getMembershipManager();
Services services = membershipManager.getServices();
return (GMSJoinLeave) services.getJoinLeave();
}

public static Integer getViewId() {
return getGmsJoinLeave().getView().getViewId();
}

private static InternalDistributedSystem getInternalDistributedSystem() {
InternalDistributedSystem distributedSystem = InternalDistributedSystem.getAnyInstance();
if (distributedSystem == null) {
Locator locator = Locator.getLocator();
return (InternalDistributedSystem) locator.getDistributedSystem();
} else {
return distributedSystem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Random;
import java.util.Set;

import com.gemstone.gemfire.internal.logging.LogService;
import org.apache.logging.log4j.Logger;

import com.gemstone.gemfire.DataSerializer;
Expand All @@ -47,6 +48,9 @@
*/
public class NetView implements DataSerializableFixedID {

private static final Logger logger = LogService.getLogger();


private int viewId;
private List<InternalDistributedMember> members;
private int[] failureDetectionPorts = new int[10];
Expand Down Expand Up @@ -86,6 +90,7 @@ public NetView(InternalDistributedMember creator, int viewId, List<InternalDistr
crashedMembers = Collections.emptySet();
this.creator = creator;
Arrays.fill(failureDetectionPorts, -1);

}

// legacy method for JGMM
Expand Down
Loading

0 comments on commit edc1c4c

Please sign in to comment.