Ticket #153 (closed enhancement: fixed)
Refactor background image creation
| Reported by: | harri | Owned by: | harri |
|---|---|---|---|
| Priority: | major | Milestone: | 0.6.0 |
| Component: | SWING_UI | Version: | |
| Keywords: | Cc: | ||
| Test Case Result: | pass |
Description (last modified by harri) (diff)
Current thumbnail creation works reasonably well but it does have scalability problems. Every BrowserWindow? has its own instance of ThumbCreatorThread? and also indexing threads and export threads create new instances. If all of these are active at the same time memory consumption can explode and at least JAI tile cache will be trashed. This is now a more real possibility than before as new BrowserWindow? instances are opened for image viewing.
After preview instances are implemented there will be even more instance creation and memory consumption will increase more (non-subsampled instances must be used)
Proposed solution
Single thread does all background image processing tasks.
- If this thread is sleeping any object can initiate background processing operation. This operation is described in a separate object.
- After the thread has completed image processing operation it notifies all registered objects of the newly created instance. As a return value to this notification any of the notified objects can give a new request for background processing operation.
- If no requests are returned the thread goes back to sleep
- If 1 request is returned it is processed as described above
- If several requests are returned one of these is selected using round robin between the registered objects. Also co-operatiove priorization between the requests could be applied (e.g. so that requests for creating thumbnail that is currently visible in UI could be given higher priority) Other requests are discarded, the proposing object must make a new proposal after the selected operation completes.
