Skip to content

Instantly share code, notes, and snippets.

@jldubz
Created July 14, 2015 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jldubz/6a3b6a544f5aab401d93 to your computer and use it in GitHub Desktop.
Save jldubz/6a3b6a544f5aab401d93 to your computer and use it in GitHub Desktop.
When updating an Issue in Atlassian JIRA using a Groovy Script Listener, the fields will become out-of-sync with what the GUI says they equal. (Resolution set to Duplicate but the GUI still says it is Unresolved etc) By performing the updates within a new thread, the GUI updates as well. I have no idea why...
class SampleIssueListener extends AbstractIssueEventListener {
@Override
void workflowEvent(IssueEvent event) {
//Prepare and Validate update/transition
//Create a worker thread that waits for 2 seconds before performing the transition.
ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
Runnable runnableUpdate = new Runnable() {
@Override
public void run() {
//Perform Update/Transition
//Preparation needs to occur outside of this Runnable or you will encounter permission issues
}
};
worker.schedule(runnableUpdate, 2, TimeUnit.SECONDS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment