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 f09e4e5c13..e197c63746 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 @@ -119,11 +119,16 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex } String serverName = WebUtil.getServerName(); - String sql = "UPDATE AD_Session SET Processed='Y' WHERE Processed='N' AND ServerName=?"; + final String sql = "UPDATE AD_Session SET Processed='Y' WHERE Processed='N' AND ServerName=?"; int no = DB.executeUpdate(sql, new Object[] {serverName}, false, null); if (no < 0) { throw new AdempiereException("UpdateSession: Cannot Destroy All Session"); } + final String sqlp = "UPDATE AD_PInstance SET IsProcessing='N' WHERE IsProcessing='Y' AND EXISTS (SELECT 1 FROM AD_Session s WHERE s.AD_Session_ID=AD_PInstance.AD_Session_ID AND s.ServerName=?)"; + int nop = DB.executeUpdate(sqlp, new Object[] {serverName}, false, null); + if (nop < 0) { + throw new AdempiereException("UpdateSession: Cannot Update All Process Instances"); + } Adempiere.removeServerStateChangeListener(this); }