mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 18:58:51 +00:00
068f4169b9
Enhance ThreadManager to allow a expiration time interval to be assigned to tasks, and expire those tasks after that time limit has passed. Enhance TNonblockingServer to utilize this capability so it can be used for overload resilience. Note: expired entries are only removed from the queue head, so the mechanism in ThreadManager may not do what you expect if you have heterogeneous expiration times. That's not an issue with TNonblockingServer (which will give all tasks the same limit) and might not be in other cases where most tasks have the same limit and the rest execute quickly. A full-up timeout queue would be more complex and have greater overhead than that used here. It's unnecessary for the task at hand so I didn't go that route... The TNonblocking interface is simple: a setTaskExpireTime() accepts a 64-bit millisecond argument. 0 means infinite. A getTaskExpireTime() accessor completes the interface. The ThreadManager interface involves an added argument to add() for the expiration interval and a setExpireCallback() function for setting a callback that is called for expired tasks (for this project this is necessary to shut down the associated connection). git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920673 13f79535-47bb-0310-9956-ffa450edef68 |
||
---|---|---|
.. | ||
cocoa | ||
cpp | ||
csharp | ||
erl | ||
hs | ||
java | ||
js | ||
ocaml | ||
perl | ||
php | ||
py | ||
rb | ||
st | ||
Makefile.am |