Skip to content

Commit

Permalink
SAK-45558 Kernel invalid discovery address when range = 1 (sakaiproje…
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored May 28, 2021
1 parent c963dfa commit af3abb4
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.sakaiproject.ignite;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.apache.ignite.configuration.CacheConfiguration;
Expand Down Expand Up @@ -112,13 +112,20 @@ protected IgniteConfiguration createInstance() {
TcpDiscoverySpi tcpDiscovery = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();

List<String> discoveryAddresses = new ArrayList<>();
Set<String> discoveryAddresses = new HashSet<>();
String localDiscoveryAddress;
if (StringUtils.isNotBlank(address)) {
tcpCommunication.setLocalAddress(address);
tcpDiscovery.setLocalAddress(address);
discoveryAddresses.add(address + ":" + (port + range) + ".." + (port + range + range - 1));
localDiscoveryAddress = address;
} else {
discoveryAddresses.add("127.0.0.1:" + (port + range) + ".." + (port + range + range - 1));
localDiscoveryAddress = "127.0.0.1";
}

if (range - 1 == 0) {
discoveryAddresses.add(localDiscoveryAddress + ":" + (port + range));
} else {
discoveryAddresses.add(localDiscoveryAddress + ":" + (port + range) + ".." + (port + range + range - 1));
}

tcpCommunication.setLocalPort(port);
Expand Down

0 comments on commit af3abb4

Please sign in to comment.