executeOnPooledThread or how to get a Thread from it?
Dear all,
Could you please assist me with next question. I'm currently developing plugin which run some Ant task and output it stream to console, By the end it should generate file which I need to work with further. However I've faced a problem while using idea open api threads. I don't think that I'm capable to find solution by my own. Is there any way to get a thread from ApplicationManager.getApplication or any other class implementation options to get a thread. As for now I use:
ApplicationManager.getApplication().executeOnPooledThread
I need to execute task and only once it's executed to move some extracted result (xml file) to required directory. However my process does not wait for its' completion and it's trying to move it.
Are there any options? or you may advice any solutions upon that problem? Are there any listeners to trigger required method to be envoked later?
Please sign in to leave a comment.
I'm not sure I understand the question completely. executeOnPooledThread returns a Future that allows you to track when a task has finished.
If you're working with java.io.File, there's nothing preventing you from doing the operations on the same background thread. If you work with VFS, you'd need a write action. For that, you can do Application#invokeLater at then end of the background task and do the work inside the passed runnable.
Hope that helps.
Thank you. I've found the problem and managed to fix it.