Skip to content

Commit

Permalink
GEODE-7613: move multicast address init to where it's needed (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill authored Dec 21, 2019
1 parent f4854ef commit 6c7ad1f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1508,21 +1508,6 @@ public boolean isLoner() {
return getLocators().equals("") && getMcastPort() == 0;
}

static InetAddress _getDefaultMcastAddress() {
// Default MCast address can be just IPv4 address.
// On IPv6 machines, JGroups converts IPv4 address to equivalent IPv6 address.
try {
String ipLiteral = "239.192.81.1";
return InetAddress.getByName(ipLiteral);
} catch (UnknownHostException ex) {
// this should never happen
throw new Error(
String.format("Unexpected problem getting inetAddress: %s",
ex),
ex);
}
}

@Immutable
static final Map<String, Method> checkers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -367,7 +368,22 @@ public interface DistributionConfig extends Config, LogConfig, StatisticsConfig
* The default value of the {@link ConfigurationProperties#MCAST_ADDRESS} property. Current value
* is <code>239.192.81.1</code>
*/
InetAddress DEFAULT_MCAST_ADDRESS = AbstractDistributionConfig._getDefaultMcastAddress();
InetAddress DEFAULT_MCAST_ADDRESS = _getDefaultMcastAddress();

static InetAddress _getDefaultMcastAddress() {
// Default MCast address can be just IPv4 address.
// On IPv6 machines, JGroups converts IPv4 address to equivalent IPv6 address.
try {
String ipLiteral = "239.192.81.1";
return InetAddress.getByName(ipLiteral);
} catch (UnknownHostException ex) {
// this should never happen
throw new Error(
String.format("Unexpected problem getting inetAddress: %s",
ex),
ex);
}
}

/**
* Returns the value of the {@link ConfigurationProperties#MCAST_TTL} property
Expand Down

0 comments on commit 6c7ad1f

Please sign in to comment.