Reputation: 29576
I read Jersey documentation and did not find an answer to a simple question: when I create a singleton resource, how is it used to serve requests?
When serving requests by a singleton resource, does Jersey queue requests and access the singleton instance for each request synchronously, or does Jersey access the same singleton instance concurrently?
Upvotes: 2
Views: 517
Reputation: 209082
It's access concurrently, so you should make sure that if you want to use a singleton, that the resource class is thread-safe, and any request scope services injected (by field or constructor) are proxied
Upvotes: 1