int () { final Application application = ApplicationManager.getApplication(); /* TODO: uncomment assertion when problems in Perforce plugin are fixed. LOG.assertTrue(!application.isDispatchThread(), "InterruptibleActivity is supposed to be lengthy thus must not block Swing UI thread"); */ final Semaphore semaphore = new Semaphore(); semaphore.down(); application.executeOnPooledThread(() -> { try { start(); } finally { semaphore.up(); } }); final int rc = waitForSemaphore(semaphore); if (rc != 0) { application.executeOnPooledThread(() -> interrupt()); } return rc; }