This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
import java.util.stream.*;
|
||||||
import javax.annotation.*;
|
import javax.annotation.*;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import org.redkale.net.*;
|
import org.redkale.net.*;
|
||||||
@@ -347,14 +348,7 @@ public abstract class NodeServer {
|
|||||||
if (groups == null || groups.isEmpty()) return null;
|
if (groups == null || groups.isEmpty()) return null;
|
||||||
List<String> tmpgroup = new ArrayList<>(groups);
|
List<String> tmpgroup = new ArrayList<>(groups);
|
||||||
Collections.sort(tmpgroup); //按字母排列顺序
|
Collections.sort(tmpgroup); //按字母排列顺序
|
||||||
boolean flag = false;
|
final String groupid = tmpgroup.stream().collect(Collectors.joining(";"));
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String g : tmpgroup) {
|
|
||||||
if (flag) sb.append(';');
|
|
||||||
sb.append(g);
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
final String groupid = sb.toString();
|
|
||||||
Transport transport = application.resourceFactory.find(groupid, Transport.class);
|
Transport transport = application.resourceFactory.find(groupid, Transport.class);
|
||||||
if (transport != null) return transport;
|
if (transport != null) return transport;
|
||||||
final List<Transport> transports = new ArrayList<>();
|
final List<Transport> transports = new ArrayList<>();
|
||||||
@@ -362,11 +356,7 @@ public abstract class NodeServer {
|
|||||||
transports.add(loadTransport(group));
|
transports.add(loadTransport(group));
|
||||||
}
|
}
|
||||||
Set<InetSocketAddress> addrs = new HashSet();
|
Set<InetSocketAddress> addrs = new HashSet();
|
||||||
for (Transport t : transports) {
|
transports.forEach(t -> addrs.addAll(Arrays.asList(t.getRemoteAddresses())));
|
||||||
for (InetSocketAddress addr : t.getRemoteAddresses()) {
|
|
||||||
addrs.add(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Transport first = transports.get(0);
|
Transport first = transports.get(0);
|
||||||
Transport newTransport = new Transport(groupid, application.findGroupProtocol(first.getName()), application.getWatchFactory(),
|
Transport newTransport = new Transport(groupid, application.findGroupProtocol(first.getName()), application.getWatchFactory(),
|
||||||
application.transportBufferPool, application.transportChannelGroup, this.sncpAddress, addrs);
|
application.transportBufferPool, application.transportChannelGroup, this.sncpAddress, addrs);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.nio.channels.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.function.*;
|
import java.util.function.*;
|
||||||
|
import java.util.stream.*;
|
||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
import org.redkale.watch.*;
|
import org.redkale.watch.*;
|
||||||
|
|
||||||
@@ -84,14 +85,7 @@ public final class Transport {
|
|||||||
tmpgroup.add(t.name);
|
tmpgroup.add(t.name);
|
||||||
}
|
}
|
||||||
Collections.sort(tmpgroup); //必须按字母排列顺序确保,相同内容的transport列表组合的name相同,而不会因为list的顺序不同产生不同的name
|
Collections.sort(tmpgroup); //必须按字母排列顺序确保,相同内容的transport列表组合的name相同,而不会因为list的顺序不同产生不同的name
|
||||||
boolean flag = false;
|
this.name = tmpgroup.stream().collect(Collectors.joining(";"));
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (String g : tmpgroup) {
|
|
||||||
if (flag) sb.append(';');
|
|
||||||
sb.append(g);
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
this.name = sb.toString();
|
|
||||||
this.watch = first.watch;
|
this.watch = first.watch;
|
||||||
this.protocol = first.protocol;
|
this.protocol = first.protocol;
|
||||||
this.tcp = "TCP".equalsIgnoreCase(first.protocol);
|
this.tcp = "TCP".equalsIgnoreCase(first.protocol);
|
||||||
@@ -99,11 +93,7 @@ public final class Transport {
|
|||||||
this.bufferPool = first.bufferPool;
|
this.bufferPool = first.bufferPool;
|
||||||
this.clientAddress = first.clientAddress;
|
this.clientAddress = first.clientAddress;
|
||||||
Set<InetSocketAddress> addrs = new HashSet();
|
Set<InetSocketAddress> addrs = new HashSet();
|
||||||
for (Transport t : transports) {
|
transports.forEach(t -> addrs.addAll(Arrays.asList(t.getRemoteAddresses())));
|
||||||
for (InetSocketAddress addr : t.getRemoteAddresses()) {
|
|
||||||
addrs.add(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateRemoteAddresses(addrs);
|
updateRemoteAddresses(addrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user