jurmous / etcd4j

Java / Netty client for etcd, the highly-available key value store for shared configuration and service discovery.
Apache License 2.0
267 stars 83 forks source link

Is etcd4j considered ThreadSafe ? #132

Closed sheinbergon closed 7 years ago

sheinbergon commented 7 years ago

Hello

I've done some digging inside the source code. I'm assuming Netty is thread-safe due to it's async event-loop based design. Given that there's no connection pooling done, I'm guessing that also simplifies things for you

Classes like ConnectionState however, are definitely not thread-safe.

What's your philosophy in regards to sharing a single EtcdClient between several threads ?

lburgazzoli commented 7 years ago

The model is one connection per request so you should be able to share a client among threads, ConnectionState is per request/connection so it should not suffer from threading issues.

If you spot anything wrong, let us know or open a PR

sheinbergon commented 7 years ago

@lburgazzoli thanks , let's this open for a bit longer. I want to take a further look at the code and make sure we are not missing out on anything

lburgazzoli commented 7 years ago

Going to close this, let me know if you ahve any additional question