How do I check there is uncompleted write action or invokeLater?

Answered

Hello.

In order to avoid deadlock, I'm currently invoking write action like codes below.

ApplicationManager.getApplication().invokeLaterOnWriteThread({
ApplicationManager.getApplication().runWriteAction(compute)
}, ModalityState.NON_MODAL)

But I recently noticed that this can cause synchronization error(for example, modifying arrays while iterating them).

How do I check if there is currently working or uncompleted write action?

Or is there another way to avoid deadlock, not using invokeLater?

 

---------

Edit:

I solved it by

https://plugins.jetbrains.com/docs/intellij/plugin-listeners.html?from=jetbrains.org#defining-application-level-listeners

 

Please sign in to leave a comment.