use of org.olat.core.gui.control.Disposable in project OpenOLAT by OpenOLAT.
the class FormLayoutContainer method dispose.
/**
* Dispose all child elements from this container
*
* @see org.olat.core.gui.control.Disposable#dispose()
*/
@Override
public void dispose() {
// cleanup temporary files)
for (FormItem formItem : getFormItems()) {
if (formItem instanceof Disposable) {
Disposable disposableFormItem = (Disposable) formItem;
disposableFormItem.dispose();
}
}
}
use of org.olat.core.gui.control.Disposable in project openolat by klemens.
the class FormLayoutContainer method dispose.
/**
* Dispose all child elements from this container
*
* @see org.olat.core.gui.control.Disposable#dispose()
*/
@Override
public void dispose() {
// cleanup temporary files)
for (FormItem formItem : getFormItems()) {
if (formItem instanceof Disposable) {
Disposable disposableFormItem = (Disposable) formItem;
disposableFormItem.dispose();
}
}
}
use of org.olat.core.gui.control.Disposable in project OpenOLAT by OpenOLAT.
the class UserSessionManager method signOffAndClearWithout.
/**
* called from signOffAndClear()
* called from event -> MUEvent
* the real work to do during sign off but without sending the multiuserevent
* this is used in case the user logs in to node1 and was logged in on node2 =>
* node2 catches the sign on event and invalidates the user on node2 "silently", e.g.
* without firing an event.
*/
private void signOffAndClearWithout(final UserSession usess) {
boolean isDebug = log.isDebug();
if (isDebug)
log.debug("signOffAndClearWithout() START");
final IdentityEnvironment identityEnvironment = usess.getIdentityEnvironment();
final SessionInfo sessionInfo = usess.getSessionInfo();
final Identity ident = identityEnvironment.getIdentity();
if (isDebug)
log.debug("UserSession:::logging off: " + sessionInfo);
if (usess.isAuthenticated() && usess.getLastHistoryPoint() != null && !usess.getRoles().isGuestOnly()) {
historyManager.persistHistoryPoint(ident, usess.getLastHistoryPoint());
}
/**
* use not RunnableWithException, as exceptionHandlng is inside the run
*/
Runnable run = new Runnable() {
@Override
public void run() {
Object obj = null;
try {
// do logging
if (ident != null) {
ThreadLocalUserActivityLogger.log(OlatLoggingAction.OLAT_LOGOUT, UserSession.class, CoreLoggingResourceable.wrap(ident));
}
// notify all variables in the store (the values) about the disposal
// if
// Disposable
List<Object> storeList = usess.getStoreValues();
for (Iterator<Object> it_storevals = storeList.iterator(); it_storevals.hasNext(); ) {
obj = it_storevals.next();
if (obj instanceof Disposable) {
// synchronous, since triggered by tomcat session timeout or user
// click and
// asynchronous, if kicked out by administrator.
// we assume synchronous
// !!!!
// As a reminder, this .dispose() calls dispose on
// DefaultController which is synchronized.
// (Windows/WindowManagerImpl/WindowBackOfficeImpl/BaseChiefController/../
// dispose()
// !!!! was important for bug OLAT-3390
((Disposable) obj).dispose();
}
}
} catch (Exception e) {
String objtostr = "n/a";
try {
objtostr = obj.toString();
} catch (Exception ee) {
// ignore
}
log.error("exception in signOffAndClear: while disposing object:" + objtostr, e);
}
}
};
ThreadLocalUserActivityLoggerInstaller.runWithUserActivityLogger(run, UserActivityLoggerImpl.newLoggerForValueUnbound(usess));
if (authUserSessions.remove(usess)) {
// remove only from identityEnvironment if found in sessions.
// see also SIDEEFFECT!! line in signOn(..)
Identity previousSignedOn = identityEnvironment.getIdentity();
if (previousSignedOn != null && previousSignedOn.getKey() != null) {
if (isDebug)
log.debug("signOffAndClearWithout() removing from userNameToIdentity: " + previousSignedOn.getName().toLowerCase());
userNameToIdentity.remove(previousSignedOn.getKey());
userSessionCache.remove(previousSignedOn.getKey());
}
} else if (isDebug) {
log.info("UserSession already removed! for [" + ident + "]");
}
// update logged in users counters
if (sessionInfo != null) {
if (sessionInfo.isREST()) {
sessionCountRest.decrementAndGet();
} else if (sessionInfo.isWebDAV()) {
sessionCountDav.decrementAndGet();
} else {
sessionCountWeb.decrementAndGet();
}
}
if (isDebug)
log.debug("signOffAndClearWithout() END");
}
use of org.olat.core.gui.control.Disposable in project openolat by klemens.
the class UserSessionManager method signOffAndClearWithout.
/**
* called from signOffAndClear()
* called from event -> MUEvent
* the real work to do during sign off but without sending the multiuserevent
* this is used in case the user logs in to node1 and was logged in on node2 =>
* node2 catches the sign on event and invalidates the user on node2 "silently", e.g.
* without firing an event.
*/
private void signOffAndClearWithout(final UserSession usess) {
boolean isDebug = log.isDebug();
if (isDebug)
log.debug("signOffAndClearWithout() START");
final IdentityEnvironment identityEnvironment = usess.getIdentityEnvironment();
final SessionInfo sessionInfo = usess.getSessionInfo();
final Identity ident = identityEnvironment.getIdentity();
if (isDebug)
log.debug("UserSession:::logging off: " + sessionInfo);
if (usess.isAuthenticated() && usess.getLastHistoryPoint() != null && !usess.getRoles().isGuestOnly()) {
historyManager.persistHistoryPoint(ident, usess.getLastHistoryPoint());
}
/**
* use not RunnableWithException, as exceptionHandlng is inside the run
*/
Runnable run = new Runnable() {
@Override
public void run() {
Object obj = null;
try {
// do logging
if (ident != null) {
ThreadLocalUserActivityLogger.log(OlatLoggingAction.OLAT_LOGOUT, UserSession.class, CoreLoggingResourceable.wrap(ident));
}
// notify all variables in the store (the values) about the disposal
// if
// Disposable
List<Object> storeList = usess.getStoreValues();
for (Iterator<Object> it_storevals = storeList.iterator(); it_storevals.hasNext(); ) {
obj = it_storevals.next();
if (obj instanceof Disposable) {
// synchronous, since triggered by tomcat session timeout or user
// click and
// asynchronous, if kicked out by administrator.
// we assume synchronous
// !!!!
// As a reminder, this .dispose() calls dispose on
// DefaultController which is synchronized.
// (Windows/WindowManagerImpl/WindowBackOfficeImpl/BaseChiefController/../
// dispose()
// !!!! was important for bug OLAT-3390
((Disposable) obj).dispose();
}
}
} catch (Exception e) {
String objtostr = "n/a";
try {
objtostr = obj.toString();
} catch (Exception ee) {
// ignore
}
log.error("exception in signOffAndClear: while disposing object:" + objtostr, e);
}
}
};
ThreadLocalUserActivityLoggerInstaller.runWithUserActivityLogger(run, UserActivityLoggerImpl.newLoggerForValueUnbound(usess));
if (authUserSessions.remove(usess)) {
// remove only from identityEnvironment if found in sessions.
// see also SIDEEFFECT!! line in signOn(..)
Identity previousSignedOn = identityEnvironment.getIdentity();
if (previousSignedOn != null && previousSignedOn.getKey() != null) {
if (isDebug)
log.debug("signOffAndClearWithout() removing from userNameToIdentity: " + previousSignedOn.getName().toLowerCase());
userNameToIdentity.remove(previousSignedOn.getKey());
userSessionCache.remove(previousSignedOn.getKey());
}
} else if (isDebug) {
log.info("UserSession already removed! for [" + ident + "]");
}
// update logged in users counters
if (sessionInfo != null) {
if (sessionInfo.isREST()) {
sessionCountRest.decrementAndGet();
} else if (sessionInfo.isWebDAV()) {
sessionCountDav.decrementAndGet();
} else {
sessionCountWeb.decrementAndGet();
}
}
if (isDebug)
log.debug("signOffAndClearWithout() END");
}
Aggregations