use of org.apache.geode.distributed.internal.InternalLocator in project geode by apache.
the class DUnitLauncher method startLocator.
private static int startLocator(Registry registry) throws IOException, NotBoundException {
RemoteDUnitVMIF remote = (RemoteDUnitVMIF) registry.lookup("vm" + LOCATOR_VM_NUM);
final File locatorLogFile = LOCATOR_LOG_TO_DISK ? new File("locator-" + locatorPort + ".log") : new File("");
MethExecutorResult result = remote.executeMethodOnObject(new SerializableCallable() {
public Object call() throws IOException {
Properties p = getDistributedSystemProperties();
// I never want this locator to end up starting a jmx manager
// since it is part of the unit test framework
p.setProperty(JMX_MANAGER, "false");
// Disable the shared configuration on this locator.
// Shared configuration tests create their own locator
p.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
// Tell the locator it's the first in the system for
// faster boot-up
System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
// disable auto-reconnect - tests fly by so fast that it will never be
// able to do so successfully anyway
p.setProperty(DISABLE_AUTO_RECONNECT, "true");
try {
Locator.startLocatorAndDS(0, locatorLogFile, p);
InternalLocator internalLocator = (InternalLocator) Locator.getLocator();
locatorPort = internalLocator.getPort();
internalLocator.resetInternalLocatorFileNamesWithCorrectPortNumber(locatorPort);
} finally {
System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
}
return locatorPort;
}
}, "call");
if (result.getException() != null) {
RuntimeException ex = new RuntimeException("Failed to start locator", result.getException());
ex.printStackTrace();
throw ex;
}
return (Integer) result.getResult();
}
use of org.apache.geode.distributed.internal.InternalLocator in project geode by apache.
the class ClusterConfigurationServiceUsingDirDUnitTest method preTearDownCacheTestCase.
@Override
public final void preTearDownCacheTestCase() throws Exception {
for (int i = 0; i < 2; i++) {
VM vm = getHost(0).getVM(i);
vm.invoke("Removing shared configuration", () -> {
InternalLocator locator = InternalLocator.getLocator();
if (locator == null) {
return;
}
ClusterConfigurationService sharedConfig = locator.getSharedConfiguration();
if (sharedConfig != null) {
sharedConfig.destroySharedConfiguration();
}
});
}
}
use of org.apache.geode.distributed.internal.InternalLocator in project geode by apache.
the class WANTestBase method putRemoteSiteLocators.
public static void putRemoteSiteLocators(int remoteDsId, Set<String> remoteLocators) {
List<Locator> locatorsConfigured = Locator.getLocators();
Locator locator = locatorsConfigured.get(0);
if (remoteLocators != null) {
// Add fake remote locators to the locators map
((InternalLocator) locator).getlocatorMembershipListener().getAllServerLocatorsInfo().put(remoteDsId, remoteLocators);
}
}
use of org.apache.geode.distributed.internal.InternalLocator in project geode by apache.
the class FetchSharedConfigurationStatusFunction method execute.
@Override
public void execute(FunctionContext context) {
InternalLocator locator = InternalLocator.getLocator();
InternalCache cache = GemFireCacheImpl.getInstance();
DistributedMember member = cache.getDistributedSystem().getDistributedMember();
SharedConfigurationStatus status = locator.getSharedConfigurationStatus().getStatus();
String memberId = member.getName();
if (StringUtils.isBlank(memberId)) {
memberId = member.getId();
}
CliFunctionResult result = new CliFunctionResult(memberId, new String[] { status.name() });
context.getResultSender().lastResult(result);
}
use of org.apache.geode.distributed.internal.InternalLocator in project geode by apache.
the class CacheServerLoadMessage method updateLocalLocators.
public void updateLocalLocators() {
List locators = Locator.getLocators();
for (int i = 0; i < locators.size(); i++) {
InternalLocator l = (InternalLocator) locators.get(i);
ServerLocator serverLocator = l.getServerLocatorAdvisee();
if (serverLocator != null) {
serverLocator.updateLoad(location, load, this.clientIds);
}
}
}
Aggregations