Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Thrift lesson 4 exception handling of connection interruption

Shulou Source: shulou.com Published: 2022-06-03 06:05:06 09月24日 Update

Scene

The Thrift framework uses exception handling mechanism. When the client disconnects abnormally and the server tries to send data to the client at this time, the Thrift library will throw an exception, resulting in process interruption. This situation is very normal, the server side should catch the occurrence of the exception, but should not exit the exception.

The exception is caught in the thread called by the user, so there is no need to modify the code

Catch (const TTransportException& ttx)

{

/ / all exceptions thrown by the Thrift framework will be returned directly

Std::cout

Tags: Time function user processing service client client server loop code socket data framework success mechanism thread two event representative parameter Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL Huawei Shulou Information Linux