You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/08/21 08:59:43 UTC
[1/2] incubator-ignite git commit: Added TTL to multicast IP finder
Repository: incubator-ignite
Updated Branches:
refs/heads/master d69e7785a -> dd204deca
Added TTL to multicast IP finder
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/82ce0a08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/82ce0a08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/82ce0a08
Branch: refs/heads/master
Commit: 82ce0a088494a2d9adbfdf23255636dcf047f046
Parents: 452af6a
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Aug 20 17:36:02 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Aug 20 23:57:14 2015 -0700
----------------------------------------------------------------------
.../TcpDiscoveryMulticastIpFinder.java | 38 ++++++++++++++++++++
1 file changed, 38 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82ce0a08/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index b93c547..2a07879 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -99,6 +99,9 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
/** Local address */
private String locAddr;
+ /** Time to live. */
+ private Integer ttl;
+
/** */
@GridToStringExclude
private Collection<AddressSender> addrSnds;
@@ -223,6 +226,32 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
return locAddr;
}
+ /**
+ * Set the default time-to-live for multicast packets sent out on this
+ * IP finder in order to control the scope of the multicast.
+ * <p>
+ * The TTL has to be in the range {@code 0 <= TTL <= 255}.
+ * <p>
+ * If TTL is {@code 0}, packets are not transmitted on the network,
+ * but may be delivered locally.
+ *
+ * @param ttl Time to live.
+ */
+ @IgniteSpiConfiguration(optional = true)
+ public void setTimeToLive(int ttl) {
+ this.ttl = ttl;
+ }
+
+ /**
+ * Set the default time-to-live for multicast packets sent out on this
+ * IP finder.
+ *
+ * @return Time to live.
+ */
+ public int getTimeToLive() {
+ return ttl;
+ }
+
/** {@inheritDoc} */
@Override public void initializeLocalAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException {
// If IGNITE_OVERRIDE_MCAST_GRP system property is set, use its value to override multicast group from
@@ -245,6 +274,9 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
throw new IgniteSpiException("Invalid number of address request attempts, " +
"value greater than zero is expected: " + addrReqAttempts);
+ if (ttl != null && (ttl < 0 || ttl > 255))
+ throw new IgniteSpiException("Time-to-live value is out of 0 <= TTL <= 255 range: " + ttl);
+
if (F.isEmpty(getRegisteredAddresses()))
U.warn(log, "TcpDiscoveryMulticastIpFinder has no pre-configured addresses " +
"(it is recommended in production to specify at least one address in " +
@@ -453,6 +485,9 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
sock.setSoTimeout(resWaitTime);
+ if (ttl != null)
+ sock.setTimeToLive(ttl);
+
reqPckt.setData(MSG_ADDR_REQ_DATA);
try {
@@ -722,6 +757,9 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
sock.joinGroup(mcastGrp);
+ if (ttl != null)
+ sock.setTimeToLive(ttl);
+
return sock;
}
[2/2] incubator-ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/dd204dec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dd204dec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dd204dec
Branch: refs/heads/master
Commit: dd204deca23a6bd6d8af43dabcc7bcaca2a24145
Parents: 82ce0a0 d69e778
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Aug 20 23:57:34 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Aug 20 23:57:34 2015 -0700
----------------------------------------------------------------------
modules/zookeeper/pom.xml | 89 +++++
.../zk/TcpDiscoveryZookeeperIpFinder.java | 350 +++++++++++++++++
.../tcp/ipfinder/zk/ZookeeperIpFinderTest.java | 390 +++++++++++++++++++
pom.xml | 1 +
4 files changed, 830 insertions(+)
----------------------------------------------------------------------