IDEMPIERE-2756 Background threads losing context when user log out

This commit is contained in:
Carlos Ruiz 2015-08-07 16:48:18 -05:00
parent ad6290e09c
commit b1c16a2441
1 changed files with 4 additions and 7 deletions

View File

@ -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<MSession> 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");
}
}