private InetAddress initAddress(DistributionConfig dc) { String bindAddress = dc.getBindAddress(); try { /* * note: had to change the following to make sure the prop wasn't empty in addition to not * null for admin.DistributedSystemFactory */ if (bindAddress != null && bindAddress.length() > 0) { return InetAddress.getByName(bindAddress); } else { return SocketCreator.getLocalHost(); } } catch (java.net.UnknownHostException unhe) { throw new RuntimeException(unhe); } }
public static String getBindAddressForHttpService(DistributionConfig config) { String bindAddress = config.getHttpServiceBindAddress(); if (StringUtils.isNotBlank(bindAddress)) return bindAddress; bindAddress = config.getServerBindAddress(); if (StringUtils.isNotBlank(bindAddress)) return bindAddress; bindAddress = config.getBindAddress(); if (StringUtils.isNotBlank(bindAddress)) return bindAddress; try { bindAddress = SocketCreator.getLocalHost().getHostAddress(); logger.info("RestAgent.getBindAddressForHttpService.localhost: " + SocketCreator.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { logger.error("LocalHost could not be found.", e); } return bindAddress; }
/** * @param bindName the ip address or host name that this acceptor should bind to. If null or "" * then calculate it. * @return the ip address or host name this acceptor will listen on. An "" if all local addresses * will be listened to. * @since GemFire 5.7 */ private static String calcBindHostName(Cache cache, String bindName) { if (bindName != null && !bindName.equals("")) { return bindName; } InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem(); DistributionConfig config = system.getConfig(); String hostName = null; // Get the server-bind-address. If it is not null, use it. // If it is null, get the bind-address. If it is not null, use it. // Otherwise set default. String serverBindAddress = config.getServerBindAddress(); if (serverBindAddress != null && serverBindAddress.length() > 0) { hostName = serverBindAddress; } else { String bindAddress = config.getBindAddress(); if (bindAddress != null && bindAddress.length() > 0) { hostName = bindAddress; } } return hostName; }
/** * Returns whether or not the given configuration properties refer to the same distributed system * as this <code>InternalDistributedSystem</code> connection. * * @since GemFire 4.0 */ public boolean sameSystemAs(Properties props) { DistributionConfig other = DistributionConfigImpl.produce(props); DistributionConfig me = this.getConfig(); if (!me.getBindAddress().equals(other.getBindAddress())) { return false; } // locators String myLocators = me.getLocators(); String otherLocators = other.getLocators(); // quick check if (myLocators.equals(otherLocators)) { return true; } else { myLocators = canonicalizeLocators(myLocators); otherLocators = canonicalizeLocators(otherLocators); return myLocators.equals(otherLocators); } }
try { InetAddress host = null; String bindAddress = dm.getConfig().getBindAddress(); try { if (bindAddress != null && !bindAddress.equals(DistributionConfig.DEFAULT_BIND_ADDRESS)) {
boolean isBindAddress = dc.getBindAddress() != null; try { int port = Integer.getInteger("tcpServerPort", 0).intValue();
if (config.getBindAddress() == null) { this.bindAddress = DistributionConfig.DEFAULT_BIND_ADDRESS; } else { this.bindAddress = config.getBindAddress(); config.getBindAddress(), this.sslConfig); this.mcastEnabled = true; } else {
DistributionLocatorId localLocatorId = null; if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) { localLocatorId = new DistributionLocatorId(port, config.getBindAddress()); } else { localLocatorId = new DistributionLocatorId(localLocator);
protected void initializeDistributedSystem(DistributedSystem distributedSystem) { InternalDistributedSystem ids = (InternalDistributedSystem) distributedSystem; setMemberId(ids.getMemberId()); DistributionConfig config = ids.getConfig(); setMemberName(config.getName()); setMcastPort(config.getMcastPort()); setMcastAddress(config.getMcastAddress()); String bindAddress = config.getBindAddress(); setBindAddress(bindAddress); setLocators(config.getLocators()); setUpTime(System.currentTimeMillis() - ids.getStartTime()); try { setHostAddress((bindAddress != null && bindAddress.length() > 0) ? InetAddress.getByName(bindAddress) : SocketCreator.getLocalHost()); } catch (IOException e) { /* ignore - leave null host address */} }
String bindAddr = dconfig.getBindAddress(); locators = GMSUtil.parseLocators(dconfig.getLocators(), bindAddr); if (logger.isDebugEnabled()) {
this.logFileSizeLimit = distConfig.getLogFileSizeLimit(); basicSetBindAddress(distConfig.getBindAddress()); this.tcpPort = distConfig.getTcpPort();
roles = other.getRoles(); mcastAddress = other.getMcastAddress(); bindAddress = other.getBindAddress(); serverBindAddress = other.getServerBindAddress(); locators = ((DistributionConfigImpl) other).locators;
gemFirePropertyData.setMcastPort(config.getMcastPort()); gemFirePropertyData.setMcastAddress(config.getMcastAddress().getHostAddress()); gemFirePropertyData.setBindAddress(config.getBindAddress()); gemFirePropertyData.setTcpPort(config.getTcpPort()); gemFirePropertyData.setCacheXMLFile(config.getCacheXmlFile().getAbsolutePath());