facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Cannot use guice to inject two ThriftServers #143

Closed andrewcox closed 6 years ago

andrewcox commented 10 years ago

Because ThriftServer and ThriftServiceProcessor are bound as singletons, it is difficult to create two swift servers (listening on two different ports) via guice.

We should either come up with some module changes that make this feasible, or else add instructions recommending child injectors for this.

hgschmie commented 10 years ago

Why would you ever need two thrift servers in one service?

l3fang commented 10 years ago

Henning: this is a legacy artifact that Sam decided to host two functionally separate components, Router and Writer in Calligraphus in the same jvm. Removing this needs some work.

andrewcox commented 10 years ago

There are a few reasons I can think of, and at least a handful of servers that do this. One potential reason is that if you are rate-limiting your server under overload, you might want to have a separate monitoring server so that tupperware won't get rate-limited checking your health and restart you. Another is if you are writing a proxy and you want to even have fb303 requests proxied, but you also want to expose your own monitoring information via a second service (this is what servicerouter proxy does).

ghost commented 9 years ago

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.