It seems like the services provided by the ProcessEngine are all stateless, except the IdentityService… ie. in most cases, you use a service to retrieve some bean and then work with that bean. Based on the way that it's defined in the Spring configuration, it looks like the IdentityService (and the others) are singletons. However, to start a process as a particular user you do:
identityService.setAuthenticatedUserId("userx");
…and then call to the RuntimeService to start the process (without the user, just implicitly set by calling that method on the IndentityService. Is this thread-safe? In other words, if I have a lot of threads in my application simultaneously kicking off processes, is the identity and invocation of the runtime service local to my individual thread? I'm wondering about this design decision and why the identity isn't just passed into the call to the runtime service instead of being split between the two calls. I'm working through the engine source to understand its design and this approach jumped out at me.
Thanks! - Bill