cancel
Showing results for 
Search instead for 
Did you mean: 

Thread implications of IdentityService.setAuthenticatedUser

tstephen
Champ on-the-rise
Champ on-the-rise
Hi,

I've been looking at IdentityService.setAuthenticatedUserId(String) for the first time and wonder how this is intended to be used in a multi-threaded environment?

AFAIK the ProcessEngine is a singleton that returns instances of the various services. Are these instances also singletons? I guess not since using this method would then have side-effects on the other thread(s).

So as long as each thread creates its own identity service all will be well?

Thanks in advance for clarifying
Tim
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
The services are singleton.

The setAuthenticatedUser is using a Threadlocal, which is exactly why it works in a multi threaded environment.