Background Queue with Progress Indicator

Are there any code examples on how to do this floating around? I've successfully setup a progress indicator with a backgroundable task using the ProgressManager class, but I realized now that I need to make sure that certain tasks are performed in order instead of being allowed to run simultaneously.

Another question, what's the best way to share the queue between more than one class, should I make it a project service or a module service? 

3 comments
Comment actions Permalink

So I think I managed to setup a BackgroundTaskQueue in a project service so I can share it between two classes and run some Task.Backgroundable tasks. However, it's not really doing what I was expecting. I was hoping that my in setting the tasks up in a queue the UI would show that there are tasks piling up and executed in the order they are added to the task in. This does not seem to be visible in the indicator like it is when they are running in parallel.

A second problem is that after a few upload tasks are created it seems to lock up and take much longer than when I just run them asyncronously. This would seem normal except the progress indicator locks and the amount of time it takes is much longer than I would expect the requests to take even with them running syncronously.

Here is the offending class https://github.com/nek4life/intellij-demandware/blob/master/src/com/demandware/studio/webdav/DWUpdateFileTask.java

I can make a branch with the bg queue actually implemented as well as described if that would be helpful.

Thanks!

0
Comment actions Permalink

The first part is correct. We don't have any UI that would show a queue of tasks executing sequentially.

I don't know why using BackgroundTaskQueue would introduce any performance difference in your plugin, sorry.

0
Comment actions Permalink

OK so the queue in terms of the UI was working as it was supposed to. I'll try implementing the BG queue again as a service and sharing it between my components. I'm wondering if the problem has to do with the fact that I have pooling http connections running in the BG task?

Although I'm not sure without the UI I want to go down this route. It's fairly confusing as to what exactly is happening. It would be great if there was a UI for this situation.

Thanks!

0

Please sign in to leave a comment.