Search in sources :

Example 6 with SessionEvent

use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.

the class AbstractClientSession method stop.

@Override
public void stop(int exitCode) {
    if (!m_permitToStop.tryAcquire()) {
        // we are already stopping (or have been stopped)
        return;
    }
    try {
        if (!m_desktop.doBeforeClosingInternal()) {
            m_permitToStop.release();
            return;
        }
    } catch (RuntimeException | PlatformError e) {
        m_permitToStop.release();
        throw e;
    }
    // --- Point of no return ---
    m_stopping = true;
    m_exitCode = exitCode;
    try {
        fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPING));
    } catch (Exception t) {
        LOG.error("Failed to send STOPPING event.", t);
    }
    try {
        interceptStoreSession();
    } catch (Exception t) {
        LOG.error("Failed to store the client session.", t);
    }
    if (m_desktop != null) {
        try {
            m_desktop.closeInternal();
        } catch (Exception t) {
            LOG.error("Failed to close the desktop.", t);
        }
        m_desktop = null;
    }
    try {
        cancelRunningJobs();
    } finally {
        inactivateSession();
    }
}
Also used : SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) URISyntaxException(java.net.URISyntaxException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

SessionEvent (org.eclipse.scout.rt.shared.session.SessionEvent)6 Serializable (java.io.Serializable)1 URISyntaxException (java.net.URISyntaxException)1 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 RunMonitorCancelRegistry (org.eclipse.scout.rt.server.context.RunMonitorCancelRegistry)1 SessionFutureFilter (org.eclipse.scout.rt.shared.job.filter.future.SessionFutureFilter)1 ILogoutService (org.eclipse.scout.rt.shared.services.common.security.ILogoutService)1 Test (org.junit.Test)1