How to implement a scheduled job in Jira DC as a plugin?

Hello,

I would like to implement a scheduled job in Jira DC as a plugin, but I don’t get it to work (the module will not be enabled).

I also had a look at the links below:

Can someone provide an example, on how to implement this?

Thank you!

Kind regards

Julia Janky

I found a helpful example that worked for me: book-jira7development/Chapter 11/jtricks-utilities/src/main/java/com/jtricks/jira/jobs/JTricksJob.java at master · quest4i/book-jira7development · GitHub

I just wanted to add that it is important when working with scheduled tasks that you should only use the job for scheduling purposes and not to actually execute the task itself.

I know that sounds a bit weird, but the issue is that the scheduler only has 4 threads available (which it also shares with other parts of the system) and long-running tasks can clog the system, blocking threads from execution. This can for instance result in email notifications no longer being sent and ultimately will also lead to degradated UI performance.

It is recommended to offload the actual task execution to a separate thread using the ExecutorService. See also https://developer.atlassian.com/platform/marketplace/guidelines-for-data-center-app-development/#long-running-tasks

4 Likes

Hello remie,

thanks for the hint!

Do you have an example for me?

Thank you!

Kind regards,

Julia Janky