/// <summary> /// Initializes a new instance of the <see cref="TcpDiscoverySpi"/> class. /// </summary> /// <param name="reader">The reader.</param> internal TcpDiscoverySpi(BinaryReader reader) { IpFinder = reader.ReadBoolean() ? TcpDiscoveryIpFinderBase.ReadInstance(reader) : null; SocketTimeout = reader.ReadLongAsTimespan(); AckTimeout = reader.ReadLongAsTimespan(); MaxAckTimeout = reader.ReadLongAsTimespan(); NetworkTimeout = reader.ReadLongAsTimespan(); JoinTimeout = reader.ReadLongAsTimespan(); }
/// <summary> /// Initializes a new instance of the <see cref="TcpDiscoverySpi"/> class. /// </summary> /// <param name="reader">The reader.</param> internal TcpDiscoverySpi(IBinaryRawReader reader) { IpFinder = reader.ReadBoolean() ? TcpDiscoveryIpFinderBase.ReadInstance(reader) : null; SocketTimeout = reader.ReadLongAsTimespan(); AckTimeout = reader.ReadLongAsTimespan(); MaxAckTimeout = reader.ReadLongAsTimespan(); NetworkTimeout = reader.ReadLongAsTimespan(); JoinTimeout = reader.ReadLongAsTimespan(); ForceServerMode = reader.ReadBoolean(); ClientReconnectDisabled = reader.ReadBoolean(); LocalAddress = reader.ReadString(); ReconnectCount = reader.ReadInt(); LocalPort = reader.ReadInt(); LocalPortRange = reader.ReadInt(); StatisticsPrintFrequency = reader.ReadLongAsTimespan(); IpFinderCleanFrequency = reader.ReadLongAsTimespan(); ThreadPriority = reader.ReadInt(); TopologyHistorySize = reader.ReadInt(); }
/// <summary> /// Tests the ip finders. /// </summary> /// <param name="ipFinder">The ip finder.</param> /// <param name="ipFinder2">The ip finder2.</param> private static void TestIpFinders(TcpDiscoveryIpFinderBase ipFinder, TcpDiscoveryIpFinderBase ipFinder2) { var cfg = new IgniteConfiguration { DiscoverySpi = new TcpDiscoverySpi { IpFinder = ipFinder }, JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = TestUtils.TestJavaOptions(), Localhost = "127.0.0.1" }; using (var ignite = Ignition.Start(cfg)) { // Start with the same endpoint cfg.GridName = "ignite2"; using (var ignite2 = Ignition.Start(cfg)) { Assert.AreEqual(2, ignite.GetCluster().GetNodes().Count); Assert.AreEqual(2, ignite2.GetCluster().GetNodes().Count); } // Start with incompatible endpoint and check that there are 2 topologies ((TcpDiscoverySpi) cfg.DiscoverySpi).IpFinder = ipFinder2; using (var ignite2 = Ignition.Start(cfg)) { Assert.AreEqual(1, ignite.GetCluster().GetNodes().Count); Assert.AreEqual(1, ignite2.GetCluster().GetNodes().Count); } } }