Created
July 14, 2015 22:33
-
-
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...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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