cf-java-client icon indicating copy to clipboard operation
cf-java-client copied to clipboard

Document thread-safety of APIs

Open JohannesRudolph opened this issue 5 years ago • 1 comments

We're using cf-java-client in a multi-threaded application. Are DefaultConnectionContext etc. thread-safe? This is not documented right now, and they make heavy use of threading internally (with thread pools etc.), which makes me wonder at what kind of level I can reuse objects between threads (can I reuse clients? connection contexts? none of the above?)

JohannesRudolph avatar Apr 04 '19 12:04 JohannesRudolph

The DefaultConnectionContext doesn't make use of any thread pools, but rather provides those pools to Reactor for its internal non-blocking execution needs. The documentation does provide some documentation

The lowest-level building blocks of the API are ConnectionContext and TokenProvider. These types are intended to be shared between instances of the clients, and come with out of the box implementations.

but it'd be useful to document that after instantiation the rest can be sured (so long as you aren't chasing the target of the CloudFoundryOperations instance.

nebhale avatar Apr 15 '19 18:04 nebhale