Git Product home page Git Product logo

Comments (3)

luxiaoxun avatar luxiaoxun commented on May 17, 2024

不太明白你的意思。
现在的做法是:遍历了所有的连接,如果某个连接不在newAllServerNodeSet就把这个连接删除,newAllServerNodeSet存储了所有的可用连接。

from nettyrpc.

gingerjiang avatar gingerjiang commented on May 17, 2024

代码写的真是优雅啊,向大神学习!
发现个问题,启动两个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.

luxiaoxun avatar luxiaoxun commented on May 17, 2024

如同@guoyu09403 所说,这个地方最开始的实现有问题:链接仅仅按照ip:port来区分是不对的,一个失败场景是:注册的服务断开后又重新练上来了,就会导致之间建立的TCP链接是“无效”的,所以添加了uuid:ip:port来区分每个链接是否存活有效。

from nettyrpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.