/** * Examine the size of the collection of locators running in this VM * * @return the number of locators running in this VM * @deprecated as of 7.0 use {@link #hasLocator} instead. */ public static boolean hasLocators() { return hasLocator(); }
/** * @return true if member contains one locator. From 7.0 only locator can be hosted in a JVM */ public boolean isLocator() { return Locator.hasLocator(); }
public static Integer createFirstLocatorWithDSId(int dsId) { if (Locator.hasLocator()) { Locator.getLocator().stop(); } AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(); int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite(); Properties props = test.getDistributedSystemProperties(); props.setProperty(MCAST_PORT, "0"); // props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + dsId); props.setProperty(LOCATORS, "localhost[" + port + "]"); props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost"); test.startLocatorDistributedSystem(props); return port; }
if (isReconnecting || theConfig.getLocators().length() > 0 && !Locator.hasLocator()) { defaultJoinTimeout = 60000;
@Override public void started() { this.localAddress = services.getMessenger().getMemberID(); GMSMember mbr = (GMSMember) this.localAddress.getNetMember(); if (services.getConfig().areLocatorsPreferredAsCoordinators()) { boolean preferred = false; if (services.getLocator() != null || Locator.hasLocator() || !services.getConfig().getDistributionConfig().getStartLocator().isEmpty() || localAddress.getVmKind() == ClusterDistributionManager.LOCATOR_DM_TYPE) { logger .info("This member is hosting a locator will be preferred as a membership coordinator"); preferred = true; } mbr.setPreferredForCoordinator(preferred); } else { mbr.setPreferredForCoordinator(true); } }