PreviousNextTracker indexSee it online !

(9/27) 470 - Enhance Task with Runnable

Enhance Task with a Runnable which will be run on the EDT after the task finishes successfully and convert some users of org.gjt.sp.util.AwtRunnableQueue.runAfterIoTasks(Runnable) to use this mechanism instead.

The idea is to get rid of the AwtRunnableQueue in the long term. And to couple the Runnable which should be run after a background task finishes to the background task itself.

Feedback is welcome on this idea.

Submitted thomasmey - 2012-11-17 14:29:03 Assigned ezust
Priority 5 Labels
Status pending Group None
Resolution invalid

Comments

2012-11-17 14:29:04
thomasmey

v1

Replace-WorkThreadPool-with-Executor-Framework-step4.patch (15.9Kio)

2012-12-12 21:01:18
ezust

get rid of AwtRunnableQueue in the long term? It was just introduced. You should mark it deprecated immediately if you want to remove it . Also XSearch will need to be fixed again.

2012-12-28 10:47:29
thomasmey

Hi Alan,

Mhh. I guess it would have been better to open this ticket as feature request or something. I just wanted to have the opinion of the other developers on this idea.

To get rid of the AwtRunnableQueue in the IOTasks classes is easy. But there exists several other users of this "delay work till IO is done" mechanism, which are not so easy to convert. maybe the other users are not possible to convert.

2012-12-28 17:53:23
ezust

- **assigned_to**: nobody --> jarekczek

2012-12-28 17:53:23
ezust

I agree, the AwtRunnableQueue seems like something we really don't need in the API.
Adding the setRunInDispatch(Runnable) for a Task seems much more elegant.

Other devs should look at this too since we are trying to finalize an API, but I think it's ok.
jarek?


Kazutoshi, Jarek, Matthieu, Dale?




2013-02-07 00:40:22
ezust

- **assigned_to**: jarekczek --> kpouer

2013-02-07 09:07:42
kpouer

I think the reason to have this AwtRunnableQueue is that in the first threadpool some AWT tasks had to be done after all background tasks (the coupling was wrong but it is not easy to take rid of it).
But if we can do this I have a suggestion:
In fact what is suggested looks like a lot to SwingWorkers.
When I wrote the threadpool I didn't use Swingworkers because I didn't find a way to monitor the tasks, but maybe there is a way to it ?

2013-03-16 18:44:26
ezust

We should decide on what to do about this before releasing 5.1pre1, I think.

2013-04-07 11:55:51
thomasmey

"When I wrote the threadpool I didn't use Swingworkers because I didn't find
a way to monitor the tasks, but maybe there is a way to it ?"

maybe there is, but I didn't look into this yet.

I would like to close this patch, as I'm working on another idea:

The idea is to add a TaskManager.addNextTask(currentTask, nextTask) method. Depending on the Task type (subclass IoTask or AwtTask), when the depending task is finshed (i.e. fireDone() is called) the next Task in the next Task List get scheduled in either Background or EDT depending on the task type. The next Task queue is polled and scheduled till the queue is empty or till a AwtTask is hit (The AwtTask is scheduled on the EDT and the remaining Tasks in the next Task queue get's attached to the this AwtTask) I hope to post some code in the next week or so.

what do you think?

2013-04-08 08:45:56
kpouer

But in that case it would have the same behavior as we had before, when an AWT task is running, no other task can be started ?

2013-04-13 11:25:16
thomasmey

So some code, please have a look and tell me what do you think about the direction this is heading\!

"But in that case it would have the same behavior as we had before, when an AWT task is running, no other task can be started ?" -> The current implementation allows several task to run. Or am I missing something?

This patch is based on the refactor IoTask patch.

2013-04-13 11:25:46
thomasmey

v1

TaskManager-Refactor-AwtTask-IoTask.patch (25.2Kio)

2013-04-13 22:12:08
ezust

so to clarify, do I need to apply 3 patches in this order to test this ticket?
1. the patch from ticket# 3610167,
2. the patch below that is for refactoring IO tasks
3. the Replace-WorkThreadPool-with-executor.patch

Just tried applying them to trunk, each of them has a couple of hunks that fail, and #3 had 4 hunks that failed.


2013-04-14 08:21:22
thomasmey

Hi,

my current patch queue is:
$ hg qseries
Fix-Hypersearch-Excessive-Mode-Usage.patch
HyperSearch-Make-Abort-work-reliable.patch
TaskManager-Refactor-ioTask.patch
TaskManager-Refactor-AwtTask-IoTask.patch

But you should actullally just need these two:
- TaskManager-Refactor-ioTask.patch (from 3610167)
- TaskManager-Refactor-AwtTask-IoTask.patch (from this one)

TaskManager-Refactor-ioTask.patch seems to not apply cleanly on the trunk, because of the other ones in the queue. Shall I rework the patch to apply cleanly? Or can we get the other two applied to the trunk first?

The third patch is not needed anymore (Replace-WorkThreadPool-with-executor.patch) as it becomes obsolet with the new idea in "TaskManager-Refactor-AwtTask-IoTask.patch". Shall I remove the file from this side?

2013-04-15 17:19:05
ezust

I don't know what ticket# the Fix-Hypersearch-Excessive-Mode-Usage.patch is in.
Tried to apply HyperSearch-Make-Abort-work-reliable.patch and failed.
You ask: "Shall I rework the patch to apply cleanly? Or can we get the other two applied to the trunk first?"
I would be happy if either or both things happened.

In general, if your patch depends on another ticket to be applied first, you should list the ticket number there, to help us figure things out faster.

2013-04-15 18:38:25
thomasmey

v2 - rebased against the new TaskManager-Refactor-ioTask.patch

TaskManager-Refactor-AwtTask-IoTask.patch (25.2Kio)

2013-04-15 18:40:09
thomasmey

Hi,

So I did the rebases: Please apply:
1.) TaskManager-Refactor-ioTask.patch v2 from Patch https://sourceforge.net/tracker/?func=detail&aid=3610167&group_id=588&atid=300588
2.) TaskManager-Refactor-AwtTask-IoTask.patch from this patch

Everything should apply cleanly now against trunk when applied in above order.

2013-06-07 06:28:06
ezust

- **assigned_to**: kpouer --> ezust

2013-06-09 05:36:09
ezust

I can apply the patch cleanly but I get a compile error on buffer.java:307 cannot find symbol getIoTask()

2013-06-09 05:36:09
ezust

- **status**: open --> open-remind

2013-06-09 05:40:09
ezust

- **status**: open-remind --> open

2013-06-09 05:40:09
ezust

Also, does the "Replace WorkThreadPool with Executor Framework.patch" - is that still relevant? If so, then both patches need to be rebased.

2013-06-30 20:14:50
ezust

- **status**: open --> pending-invalid

2013-06-30 20:14:50
ezust

Setting as invalid/pending until an updated patch is attached.