Okay, I don't known when I'll find time the next days. So attached the second patch of the conversion described in patch tracker https://sourceforge.net/tracker/?func=detail&aid=3556968&group_id=588&atid=300588.
Attached patch converts all WorkRequest users to the Task API.
An open and still untested problem/point is the abortion or cancelation of a "IOTask". But you will get the idea of the conversion. Please have a look and give me feedback.
Rebased on step1-v4 and several fixes.
For WorkThreadPool.java, it was marked deprecated before your changes, and now that you've rewritten the class, is it still deprecated? Shouldn't the API docs/@deprecated stuff be updated too?
Yes and no! After this patch (step 2) the WorkThreadPool class is used to implement a queue for Tasks/Runnables to run in the AWT-EventQueue-Thread after all pending IO-Tasks are finished. Maybe a third step is necessary to move this AWT task queue (and resp. functionality) to the TaskManager class.
This step 3 should also get rid of the IOProgressMonitor class.
So in the long run we should get rid of the WorkThreadPool class.
And yes, when a final form is found, the API docs/@deprecated stuff should be updated.
Testing your 2 patches now and it works great!! I will keep testing for another couple of days before either I or matthieu commits it.
Yes, they should work :-)
Two things I want to point out:
- Like I already wrote: I'm not sure what to do with the old abort() mechanism. The best thing would be to convert all users to use a race safe interrupt() mechanism. But it should mostly work in the current implemention.
- The IO tasks submitted by the Hyperserach uses temporary buffers. These temporary buffers submit their IO task to the current thread and are not submitted via ThreadUtilites helper class and their for you cannot see these tasks in the task manager docklet. I'm not sure what to do with this optimization.
New version of the patch attached.
Fixes:
- I screwed up the waiting of the queue AWT thread in TaskManager.waitForIoTasks(). We really wait now for the queued AWT task to finish.
v3
Updates patch attached.
The new patch uses Thread.interrupted() for Cancellation of a Task and gets rid of the Abort mechanism.
v4
v5
Rebased and I think I found a bug in the Task class. the "thread" attribute has to be volatile, without it I can't see how the cancel() method should work correctly!
v6