
Task-level timeout for advanced run and schedule tasks
A task-level timeout mechanism is introduced in order to avoid the never-finished running tasks consuming server resources and thus decreasing the server performance. With the mechanism, you can specify a time duration for a task, and ask JReport Enterprise Server to cancel the task or to notify you or someone else of the task status via e-mail if the task has not yet finished running when the task duration is up. To do this:
- Do either of the following to enable the task-level timeout mechanism.
- In the server.properties file, set the task.duration.en able property to true.
- On the JReport Administration page, click Configuration on the system toolbar, then select the Advanced tab and check the Enable Task Duration option.
- Set task duration check frequency. By default, JReport Enterprise Server checks task duration every 30 seconds. The period value can be reset either by the task.duration.che ck_cycle property in the server.properties file or by the Status Refresh Interval option in the Advanced tab of the JReport Administration > Configuration page. Note that the value must be an integer greater than 0. Since task duration check frequency affects server performance, it is recommended that you set the value according to your system environment.
- Restart JReport Enterprise Server if you have modified the Advanced tab.
- Use the Duration tab in the Advanced Run and Schedule dialogs to specify task duration.
- In the Timeout text box, specify the time limit for when the task can run before notifying of the timeout or canceling the task.
- If you want to notify someone of the task status if the task has not yet finished running when the task duration is up, check Notify by e-mail after the specified time and specify the mail address in the Mail To text box.
- If you want JReport Enterprise Server to cancel the task when the task duration is up but the task is not finished ye, check Cancel the task after the specified time.
- Click Finish to submit the task.
Then, when the specified task duration is up but the task is not finished running,
- For an Advanced Run task,
- If you have specified to have server cancel the task when the task duration is up, the task will be cancelled automatically, however a record for the task will be still remained in the Background Tasks table of the My Tasks page, shown with a sign of cancellation.
- If you haven't checked the Cancel the task after the specified time option in the Duration tab, the task will be switched to run in background mode, in which case, you can choose to cancel the task manually. To do this. select the task row in the Background Tasks table, right-click in the row and select Delete from the shortcut menu.
- For a Schedule task,
- If you have specified to have server cancel the task when the task duration is up, the task will be cancelled automatically, and a task completed record will be added in the Completed table of the My Tasks page, with the Is Successful status shown as No.
- If you haven't checked the Cancel the task after the specified time option in the Duration tab, the task will still be listed in the Running table of the My Tasks page. Then, if you want to cancel the task manually, select the task row in the Running table, then click Stop on the task bar of the My Tasks page.
Notes:
- JReport Enterprise Server may not cancel a task right after the specified task duration is up due to check frequency.
- It is recommended that the task duration is set to about five times of the required time for finishing running the task.
- For API usage about this feature, see the JReport Enterprise Server Javadoc in
<install_root>\help\server\en\api.
