VCS: continuation: call "finally" parts even in case of not caught exception

This commit is contained in:
irengrig
2011-04-08 13:46:45 +04:00
parent 0f5ecd3736
commit d09514da77
2 changed files with 9 additions and 2 deletions
@@ -85,13 +85,14 @@ public class TestContinuationAction extends AnAction {
catch (InterruptedException e1) {
//
}
context.suspend();
throw new IllegalStateException();
/*context.suspend();
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
context.ping();
}
}, ModalityState.NON_MODAL);
}, ModalityState.NON_MODAL);*/
}
},
new LongTaskDescriptor("Third"), new ReportTask("Third complete"),
@@ -17,6 +17,7 @@ package com.intellij.util.continuation;
import com.intellij.CommonBundle;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
@@ -26,6 +27,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vcs.changes.BackgroundFromStartOption;
import com.intellij.util.WaitForProgressToShow;
import com.intellij.util.concurrency.Semaphore;
import sun.util.LocaleServiceProviderPool;
/**
* @author irengrig
@@ -35,6 +37,7 @@ import com.intellij.util.concurrency.Semaphore;
public class SameProgressRunner extends GeneralRunner {
private final Thread myInitThread;
private final Semaphore mySemaphore;
private final static Logger LOG = Logger.getInstance("#com.intellij.util.continuation.SameProgressRunner");
public SameProgressRunner(Project project, boolean cancellable, final String commonName) {
super(project, cancellable);
@@ -90,6 +93,9 @@ public class SameProgressRunner extends GeneralRunner {
current.run(this);
}
} catch (ProcessCanceledException ignored) {
} catch (Throwable t) {
LOG.error(t);
myIndicator.cancel();
}
}
}