use of org.rstudio.studio.client.application.events.InterruptStatusEvent in project rstudio by rstudio.
the class ApplicationInterrupt method interruptR.
public void interruptR(final InterruptHandler handler) {
if (interruptRequestCounter_ == 0) {
interruptRequestCounter_ = 1;
interruptUnresponsiveTimer_ = new Timer() {
@Override
public void run() {
showInterruptUnresponsiveDialog();
}
};
interruptUnresponsiveTimer_.schedule(10000);
eventBus_.fireEvent(new InterruptStatusEvent(InterruptStatusEvent.INTERRUPT_INITIATED));
server_.interrupt(new VoidServerRequestCallback() {
@Override
public void onSuccess() {
eventBus_.fireEvent(new InterruptStatusEvent(InterruptStatusEvent.INTERRUPT_COMPLETED));
finishInterrupt(handler);
}
@Override
public void onFailure() {
finishInterrupt(handler);
}
});
} else {
interruptRequestCounter_++;
if (interruptRequestCounter_ >= 3) {
interruptUnresponsiveTimer_.cancel();
showInterruptUnresponsiveDialog();
}
}
}
Aggregations