Search in sources :

Example 1 with InterruptStatusEvent

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();
        }
    }
}
Also used : Timer(com.google.gwt.user.client.Timer) InterruptStatusEvent(org.rstudio.studio.client.application.events.InterruptStatusEvent) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Aggregations

Timer (com.google.gwt.user.client.Timer)1 InterruptStatusEvent (org.rstudio.studio.client.application.events.InterruptStatusEvent)1 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)1