I am running some code using parallel stream, the problem is that I am trying to get some values using an API provided by third-party plugin installed on Jira. This API tries that get user (I don’t know how) and I cannot pass that value to it. Now as I am using thread I assume that sub-threads do not have access to UserManager or the user which we retrieve through the Jira API. It throws user is null, and when I am not using parallel stream it works fine. Is there a way that I can provide user to the third party code.
Answer to my own question, I used this piece of code to resolve my problem -
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user);
Setting user inside a thread.