Comments (3)
不太明白你的意思。
现在的做法是:遍历了所有的连接,如果某个连接不在newAllServerNodeSet就把这个连接删除,newAllServerNodeSet存储了所有的可用连接。
from nettyrpc.
代码写的真是优雅啊,向大神学习!
发现个问题,启动两个RpcBootstrapWithoutSpring 一个127.0.0.1:18866另一个127.0.0.1:18867,
写了个while循环,不断调用,停掉其中一个服务后,循环停止,不知是被哪里中断了?重新起服务,循环也不再继续
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
ServiceDiscovery serviceDiscovery = new ServiceDiscovery("127.0.0.1:2181");
final RpcClient rpcClient = new RpcClient(serviceDiscovery);
int i = 100;
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
long startTime = System.currentTimeMillis();
System.out.println("调用 ");
final HelloService syncClient = rpcClient.create(HelloService.class);
String result = syncClient.hello("asa");
System.out.printf("%s --s \n", (System.currentTimeMillis() - startTime));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
from nettyrpc.
如同@guoyu09403 所说,这个地方最开始的实现有问题:链接仅仅按照ip:port来区分是不对的,一个失败场景是:注册的服务断开后又重新练上来了,就会导致之间建立的TCP链接是“无效”的,所以添加了uuid:ip:port来区分每个链接是否存活有效。
from nettyrpc.
Related Issues (20)
- 您好,参考您的写了一套spring-boot版,有些问题,希望得到指点
- 关于RpcServer DCL的问题 HOT 3
- RPCFuture起了一个什么样的作用 HOT 2
- 您好,关于AQS有些疑惑,请大神指点
- getState为啥调用两次 HOT 2
- 如果在RpcClientHandler的channelRead0触发之前就调用了rpcFuture.get(),岂不是直接返回null?这逻辑没问题么? HOT 4
- 请问这个能作为一个框架,或者jar包导入项目直接用吗? HOT 1
- 关于框架设计上的一些错误 HOT 4
- RPCFuture 一个疑问 HOT 2
- 自己实现了一个Sync,作用是什么,这块有点疑问? HOT 4
- 为什么RpcDecoder里面又进行了粘包半包的处理 HOT 3
- RpcClientHandler里的sendRequest方法是不是同步的? HOT 2
- 大佬,为啥测试不了的 HOT 2
- 请问如何在调用的时候动态获取bean呢? HOT 1
- client端RPC调用流程优化 HOT 2
- 支持指定IP+port调用吗 HOT 1
- LRU负载均衡的困惑
- 递归添加zk状态监听
- RpcLoadBalanceLRU
- Kryo Deserialization Vulnerability in NettyRpc 1.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nettyrpc.