use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class ClientTestRunnerSameSessionTest method afterClass.
@AfterClass
public static void afterClass() {
ISession clientSession = IClientSession.CURRENT.get();
assertTrue(clientSession instanceof JUnitClientSession);
assertEquals("anna", getCurrentUser());
m_clientSessions.add(clientSession);
assertEquals(1, m_clientSessions.size());
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class SessionFutureFilter method accept.
@Override
public boolean accept(final IFuture<?> future) {
final RunContext runContext = future.getJobInput().getRunContext();
if (runContext == null) {
return false;
}
final ISession session = runContext.getAdapter(ISession.class);
if (session == null) {
return false;
}
return m_session == session;
}
use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.
the class AbstractMultiSessionCookieStore method getDelegate.
protected CS getDelegate() {
ISession currentSession = ISession.CURRENT.get();
if (currentSession == null) {
return m_defaultCookieStore;
}
// Check cache with read lock first.
m_cookieStoresLock.readLock().lock();
try {
CS cookieStore = m_cookieStores.get(currentSession);
if (cookieStore != null) {
return cookieStore;
}
} finally {
m_cookieStoresLock.readLock().unlock();
}
// No entry found - get write lock to create it
m_cookieStoresLock.writeLock().lock();
try {
// In the meantime, the cookie store might have been created already by another thread - check again.
CS cookieStore = m_cookieStores.get(currentSession);
if (cookieStore != null) {
return cookieStore;
} else {
cookieStore = createNewCookieStore();
m_cookieStores.put(currentSession, cookieStore);
currentSession.addListener(new P_SessionStoppedListenr());
return cookieStore;
}
} finally {
m_cookieStoresLock.writeLock().unlock();
}
}
Aggregations