Author: adietish
Date: 2012-05-25 09:55:35 -0400 (Fri, 25 May 2012)
New Revision: 41421
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java
Log:
[JBIDE-11314] fixed monitor cancelling
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java 2012-05-25
13:54:21 UTC (rev 41420)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java 2012-05-25
13:55:35 UTC (rev 41421)
@@ -144,16 +144,21 @@
private static void waitForFuture(long timeout, JobResultFuture future, IProgressMonitor
monitor)
throws InterruptedException, ExecutionException, TimeoutException {
long startTime = System.currentTimeMillis();
- while (!future.isDone()
- && (System.currentTimeMillis() - startTime) < timeout) {
- if (monitor.isCanceled()) {
+ while (!future.isDone()) {
+ if (isTimeouted(startTime, timeout)
+ || monitor.isCanceled()) {
future.cancel(true);
break;
}
+
Thread.sleep(THREAD_SLEEP);
}
}
+ private static boolean isTimeouted(long startTime, long timeout) {
+ return (System.currentTimeMillis() - startTime) > timeout;
+ }
+
private static IStatus getStatus(final Job job, final JobResultFuture future) {
if (future.isCancelled()) {
Show replies by date