[keycloak-dev] Concurrency & EventsListener SPI

Marek Posolda mposolda at redhat.com
Wed Oct 4 14:38:04 EDT 2017


Factory is typically application-scoped when provider is typically 
request-scoped (hence single-threaded). Different threads can use more 
providers concurrently. In other words, provider doesn't need to be 
thread-safe (EG. if you are using collection scoped just to the 
lifecycle of single provider instance), but factory should be.

For your use-case, your collection needs to be concurrency-safe if I 
understand correctly, as it's shared for whole factory and it's possible 
that more providers (requests/threads) will concurrently update it.

Marek

On 04/10/17 16:54, Poiffaut Romain wrote:
> Hi,
>
> I am writing a provider for eventsListener SPI.
> Could anyone tell me if the provider and its provider factory need to be thread safe ?
> With more details, I need to store some events. To do so, I am using a collection created by the factory and a reference to this collection is passed to the constructor to update it.
> Does my collection needs to be concurrency-safe or is it not needed?
>
> Best regards,
> Romain
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev




More information about the keycloak-dev mailing list