From b1c16a2441732645b942851095e9871045ccc837 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 7 Aug 2015 16:48:18 -0500 Subject: [PATCH] IDEMPIERE-2756 Background threads losing context when user log out --- .../org/adempiere/webui/LoggedSessionListener.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LoggedSessionListener.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LoggedSessionListener.java index 7976a753df..572c782734 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LoggedSessionListener.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LoggedSessionListener.java @@ -66,13 +66,10 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex } public void removeADSession(String sessionID, String serverName) { - String whereClause = "WebSession=? AND ServerName=? AND Processed='N'"; - List sessions = new Query(Env.getCtx(), MSession.Table_Name, whereClause, null) - .setParameters(sessionID, serverName) - .list(); - for (MSession session : sessions) { - session.setProcessed(true); - session.saveEx(); + String sql = "UPDATE AD_Session SET Processed='Y' WHERE WebSession=? AND ServerName=? AND Processed='N'"; + int no = DB.executeUpdate(sql, new Object[] {sessionID, serverName}, false, null); + if (no < 0) { + throw new AdempiereException("UpdateSession: Cannot Destroy Session"); } }