Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何判断服务是否上线 #106

Closed
ricklii opened this issue Jul 29, 2020 · 7 comments
Closed

如何判断服务是否上线 #106

ricklii opened this issue Jul 29, 2020 · 7 comments

Comments

@ricklii
Copy link

ricklii commented Jul 29, 2020

通信器获得代理:
Application::getCommunicator()->setProperty("locator", "tars.tarsregistry.QueryObj@tcp -h 172.25.1.10 -p 17890 -t 10000");
Application::getCommunicator()->stringToProxy("MicroXXX.YServer.ZObj", myYPrx);

如何判断myYPrx是否已上线?

尝试使用myYPrx->getEndpoint().empty()来判断,似乎不行,程序直接SIGSEGV退出了

tars版本2.4.3

@ricklii
Copy link
Author

ricklii commented Jul 29, 2020

补充下,如果myYPrx已经在线的情况下,myYPrx->getEndpoint()能正常判断;不在线,会直接SIGSEGV出错

@ruanshudong
Copy link
Contributor

myYPrx->tars_ping(), 但是这个调用是同步的

@ricklii
Copy link
Author

ricklii commented Aug 6, 2020

@ruanshudong 好的,非常感谢

但是tars_ping()返回void,如何取回包判断呢

@ricklii ricklii closed this as completed Aug 6, 2020
@ricklii ricklii reopened this Aug 6, 2020
@ruanshudong
Copy link
Contributor

正常返回,不抛异常, 就表示服务已经启动, 并且能接受请求了, 你用的哪个版本的tarscpp ?

@ricklii
Copy link
Author

ricklii commented Aug 6, 2020

最近的一个版本,应该是2.4.3

@ruanshudong
Copy link
Contributor

建议升级一个版本, 这个版本发现了一个bug, 应该正好影响: myYPrx->getEndpoint()

@ricklii
Copy link
Author

ricklii commented Aug 6, 2020

好的,感谢

@ricklii ricklii closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants