This commit is contained in:
RedKale
2016-04-14 13:49:05 +08:00
parent 475583705c
commit 3aa15fde07
2 changed files with 8 additions and 10 deletions

View File

@@ -354,9 +354,7 @@ public abstract class NodeServer {
protected Transport loadTransport(final HashSet<String> groups) {
if (groups == null || groups.isEmpty()) return null;
List<String> tmpgroup = new ArrayList<>(groups);
Collections.sort(tmpgroup); //按字母排列顺序
final String groupid = tmpgroup.stream().collect(Collectors.joining(";"));
final String groupid = new ArrayList<>(groups).stream().sorted().collect(Collectors.joining(";")); //按字母排列顺序
Transport transport = application.resourceFactory.find(groupid, Transport.class);
if (transport != null) return transport;
final List<Transport> transports = new ArrayList<>();

View File

@@ -6,14 +6,14 @@
package org.redkale.net;
import java.net.*;
import java.nio.*;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.stream.*;
import org.redkale.util.*;
import org.redkale.watch.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.redkale.util.ObjectPool;
import org.redkale.watch.WatchFactory;
/**
* 传输客户端
@@ -84,8 +84,8 @@ public final class Transport {
if (first == null) first = t;
tmpgroup.add(t.name);
}
Collections.sort(tmpgroup); //必须按字母排列顺序确保相同内容的transport列表组合的name相同而不会因为list的顺序不同产生不同的name
this.name = tmpgroup.stream().collect(Collectors.joining(";"));
//必须按字母排列顺序确保相同内容的transport列表组合的name相同而不会因为list的顺序不同产生不同的name
this.name = tmpgroup.stream().sorted().collect(Collectors.joining(";"));
this.watch = first.watch;
this.protocol = first.protocol;
this.tcp = "TCP".equalsIgnoreCase(first.protocol);