goobi/goobi-production — pull request #179 by matthias-ronge (2014-07-17 12:22:31+00:00)
Title: Merge: Perform DMS exports as long running tasks (#166)

The `LongRunningTaskManager` was replaced by a newly written `TaskManager`. A `TaskSitter` cares for the task list and provides for delayed execution of tasks and shut-down of threads and executors on web-app undeploy. A new cass `EmptyTask` has been implemented as base class for new tasks.

Design improvements:
- the timer was replaced by an executor to allow to shut down the tomcat.
- Thread state is derived from Thread’s state, interrupted state and presence of an exception, not longer from some int with magic numbers which are resolved in the JSP.
- The number of concurrently starting threads is now limited and delayed starting is provided
- Exceptions are caught in a central place and can be inspected in a pop-up window in the front end.
- Deleting a task from the task list always implies the interruption of the thread.
- Cloning is used to provide restartability of a user-interrupted task, so task instances will only have exactly the fields they do really need.
- Binary file copy code with inefficiently small buffer was replaced by call to Apache Commons library that already ships with Production.
- Front-end output shows some more sensible details. Task state now gets translated.
- Detailed Javadoc in new classes of the tasks package
- Tasks title used as thread name which is visible in the debugger.

New configuration entries:
- `asynchronousAutomaticExport` - option to create a task when clicking DMS export button
- `taskManager.autoRunLimit` - limit of tasks run in parallel
- `taskManager.inspectionIntervalMillis` - time interval between two inspections of the task list
- `taskManager.keepThreads.failed.count` - maximum number of failed threads to keep around
- `taskManager.keepThreads.failed.minutes` - maximum time to keep failed threads around
- `taskManager.keepThreads.successful.count` - maximum number of succesfully finished threads to keep
- `taskManager.keepThreads.successful.minutes` - maximum time to keep succesfully finished threads
- `taskManager.showInSidebar` - whether or not to show the task manager entry in the navigation sidebar (replaces ancient `show_taskmanager` and now defaults to `true`)
- `taskManager.showSampleTask` - show an option to "add a sample task", now defaults to false

Other changes:
- Removed *duplicate* registration of listener for org.goobi.production.ImageIOInitializer from web.xml which does nothing aside from throwing a warning on application startup
- Removed some more commented-out code
- Removed `TiffWriterTask` which never did anything productive