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

- fix invalidation of session
This commit is contained in:
hengsin 2021-11-23 19:45:49 +08:00 committed by GitHub
parent 4d9faf5fae
commit d37993a992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -191,9 +191,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
//clear context, invalidate session //clear context, invalidate session
Env.getCtx().clear(); Env.getCtx().clear();
destroySession(session);
desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE);
Adempiere.getThreadPoolExecutor().schedule(() -> { Adempiere.getThreadPoolExecutor().schedule(() -> {
((SessionCtrl)session).invalidateNow();
desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE);
try { try {
desktopCache.removeDesktop(desktop); desktopCache.removeDesktop(desktop);
} catch (Throwable t) { } catch (Throwable t) {
@ -415,7 +415,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
//clear context, invalidate session //clear context, invalidate session
Env.getCtx().clear(); Env.getCtx().clear();
destroySession(session); afterLogout(session);
desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE); desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE);
//redirect to login page //redirect to login page
@ -429,7 +429,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
} }
} }
private void destroySession(final Session session) { private void afterLogout(final Session session) {
try { try {
((SessionCtrl)session).onDestroyed(); ((SessionCtrl)session).onDestroyed();
} catch (Throwable t) { } catch (Throwable t) {
@ -443,8 +443,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
*/ */
public void logoutAfterTabDestroyed(){ public void logoutAfterTabDestroyed(){
Desktop desktop = Executions.getCurrent().getDesktop(); Desktop desktop = Executions.getCurrent().getDesktop();
if (desktop.isServerPushEnabled())
desktop.enableServerPush(false);
DesktopWatchDog.removeDesktop(desktop); DesktopWatchDog.removeDesktop(desktop);
Session session = logout0(); Session session = logout0();
@ -453,7 +451,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Env.getCtx().clear(); Env.getCtx().clear();
SessionCtrl ctrl = (SessionCtrl) session; SessionCtrl ctrl = (SessionCtrl) session;
if (!ctrl.isInvalidated() && session.getNativeSession() != null) if (!ctrl.isInvalidated() && session.getNativeSession() != null)
destroySession(session); afterLogout(session);
} }