I want to ask about something that is working to my benefit but I am not sure that I understand why it happens that way.
I am using onIssueEvent method for handling issue events, including "issue updated" event. In my event handler I call IssueManager.updateIssue() for another issue and the update event is intentionally dispatched for the target issue:
@EventListener
public void onIssueEvent(IssueEvent issueEvent){
log.debug("handling update for " + issueEvent.getIssue().getKey());
/* some event handling code */
issueManager.updateIssue(user,
targetIssue,
EventDispatchOption.ISSUE_UPDATED,
false);
/* some more event handling code */
log.debug("handled update for " + issueEvent.getIssue().getKey());
}
In an example based on the data on my system:
Somehow the log output I get is something like below:
handling update for A
handling update for B
handling update for C
handled update for C
handled update for B
handled update for A
First, I was expecting IssueManager.updateIssue() method to fire an event that would be handled AFTER the current event handler finishes but somehow it acts like a method call. My event handler for Issue A resumes after B and C are finished handling their events.
Second, I was expecting to face an infinite loop and was prepared to search for a way to break it but the event handler on issue C does not dispatch an update event back to issue A, even tough it is instructed to do so.
So, all of these are against my expectations. Can someone shed a light on why it is happening this way?
(Jira 7.5.0)