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

已回答

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

 

0

请先登录再写评论。