IDEMPIERE-5049 Zk Session and Desktop object not destroy immediately after logout (#997)

- Fix invalidation of session
This commit is contained in:
hengsin 2021-11-22 21:44:33 +08:00 committed by GitHub
parent 06698688ef
commit 460a4798e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -408,10 +408,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
*/
public void logout()
{
final Desktop desktop = Executions.getCurrent().getDesktop();
if (desktop.isServerPushEnabled())
desktop.enableServerPush(false);
final Desktop desktop = Executions.getCurrent().getDesktop();
final WebApp wapp = desktop.getWebApp();
final DesktopCache desktopCache = ((WebAppCtrl) wapp).getDesktopCache(desktop.getSession());
final Session session = logout0();
@ -438,7 +435,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
} catch (Throwable t) {
t.printStackTrace();
}
session.invalidate();
((SessionCtrl)session).invalidateNow();
}
/**
@ -454,7 +451,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
//clear context, invalidate session
Env.getCtx().clear();
destroySession(session);
SessionCtrl ctrl = (SessionCtrl) session;
if (!ctrl.isInvalidated() && session.getNativeSession() != null)
destroySession(session);
}

View File

@ -105,12 +105,9 @@ public class DesktopWatchDog {
}
if (!toDestroy.isEmpty()) {
for(Session session : toDestroy) {
try {
((SessionCtrl)session).onDestroyed();
} catch (Throwable t) {
t.printStackTrace();
}
session.invalidate();
if (!((SessionCtrl)session).isInvalidated()) {
((SessionCtrl)session).invalidateNow();
}
}
}
}