void () { // in fact, the condition is "should not be called under ApplicationManager.invokeLater() and similar" ApplicationManager.getApplication().assertIsNonDispatchThread(); int counter = myBackgroundOperationCounter.getAndDecrement(); LOG.assertTrue(counter > 0, "myBackgroundOperationCounter was " + counter + " while should have been > 0"); }