Skip to content

Commit e309011

Browse files
committed
1 parent 6b32a35 commit e309011

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/InvokerResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@SPI("triple")
77
public interface InvokerResolver {
88

9-
void add(String path, Invoker<?> invoker);
9+
void add(String path, String service, Invoker<?> invoker);
1010

1111
Invoker<?> resolve(String path);
1212
}

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2FrameListener.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public void onPingAckRead(ChannelHandlerContext ctx, long data) throws Http2Exce
5252
public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream)
5353
throws Http2Exception {
5454
System.out.println("onDataRead:" + streamId);
55-
final TripleHttp2ConnectionHandler connectionHandler = ctx.pipeline().get(TripleHttp2ConnectionHandler.class);
56-
Http2Connection connection = connectionHandler.encoder().connection();
5755
Http2Stream stream = connection.stream(streamId);
5856
Http2Request request = stream == null ? null : (Http2Request) stream.getProperty(streamKey);
5957

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvokerResolver.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33

44
import org.apache.dubbo.rpc.Invoker;
55

6+
import java.util.Set;
67
import java.util.concurrent.ConcurrentHashMap;
78

89
public class TripleInvokerResolver implements InvokerResolver {
910
private final ConcurrentHashMap<String, Invoker<?>> path2Invoker = new ConcurrentHashMap<>();
11+
private final Set<String> ignoreSet = ConcurrentHashMap.newKeySet();
1012

1113
@Override
12-
public void add(String path, Invoker<?> invoker) {
14+
public void add(String path, String service,Invoker<?> invoker) {
15+
// todo path == service
16+
Invoker<?> old = path2Invoker.putIfAbsent(service, invoker);
17+
if (old != null || ignoreSet.contains(service)) {
18+
path2Invoker.remove(service);
19+
ignoreSet.add(service);
20+
}
21+
1322
path2Invoker.put(path, invoker);
1423
}
1524

dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public void unexport() {
7070
};
7171

7272
exporterMap.put(key, exporter);
73-
serviceContainer.add(invoker.getUrl().getServiceKey(), invoker);
73+
74+
String service = url.getServiceInterface();
75+
serviceContainer.add(url.getServiceKey(), service, invoker);
7476
PortUnificationExchanger.bind(invoker.getUrl());
7577
return exporter;
7678
}

0 commit comments

Comments
 (0)