use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.
the class AbstractObservableNotificationHandlerTest method testSessionStopped.
@Test
public void testSessionStopped() {
final AbstractObservableNotificationHandler<Serializable> testHandler = createGlobalHandler();
@SuppressWarnings("unchecked") INotificationListener<Serializable> l1 = mock(INotificationListener.class);
testHandler.addListener(m_testSession1, l1);
SessionEvent sessionStopEvent = new SessionEvent(m_testSession1, SessionEvent.TYPE_STOPPED);
testHandler.sessionChanged(sessionStopEvent);
assertEquals(0, testHandler.getListeners(m_testSession1).size());
}
use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.
the class AbstractClientSession method start.
@Override
public void start(String sessionId) {
Assertions.assertFalse(m_stopping, "Session cannot be started again");
Assertions.assertNotNull(sessionId, "Session id must not be null");
if (isActive()) {
throw new IllegalStateException("session is active");
}
m_id = sessionId;
interceptLoadSession();
setActive(true);
fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STARTED));
LOG.info("Client session started [session={}, user={}]", this, getUserId());
}
use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.
the class AbstractClientSession method inactivateSession.
protected void inactivateSession() {
try {
ILogoutService logoutService = BEANS.opt(ILogoutService.class);
if (logoutService != null) {
logoutService.logout();
}
} finally {
setActive(false);
fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPED));
LOG.info("Client session stopped [session={}, user={}]", this, getUserId());
}
}
use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.
the class AbstractServerSession method stop.
@Override
public void stop() {
fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPING));
m_active = false;
fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPED));
// Cancel globally registered RunMonitors of this session.
BEANS.get(RunMonitorCancelRegistry.class).cancelAllBySessionId(getId());
// Cancel running jobs of this session.
Jobs.getJobManager().cancel(Jobs.newFutureFilterBuilder().andMatch(new SessionFutureFilter(this)).andMatchNotFuture(IFuture.CURRENT.get()).toFilter(), true);
LOG.info("Server session stopped [session={}, user={}]", this, getUserId());
}
use of org.eclipse.scout.rt.shared.session.SessionEvent in project scout.rt by eclipse.
the class AbstractServerSession method start.
@Override
public final void start(String sessionId) {
Assertions.assertNotNull(sessionId, "Session id must not be null");
m_id = sessionId;
Assertions.assertFalse(isActive(), "Session already started");
assignUserId();
interceptLoadSession();
m_active = true;
fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STARTED));
LOG.info("Server session started [session={}, user={}]", this, getUserId());
}
Aggregations