void (boolean cancel) { try { myProgressIndicatorLock.lock(); if (myProgressCheckingFuture != null) { myProgressCheckingFuture.cancel(true); } if (myProgressIndicator.isRunning()) { if (cancel) { myProgressIndicator.cancel(); } else { myProgressIndicator.stop(); } } myProgressCheckingFuture = null; } finally { myProgressIndicatorLock.unlock(); } }