IDEMPIERE-2756 Background threads losing context when user log out - fix validation / integrate fix from hengsin: error when user close the browser tab while a report/process is still running

This commit is contained in:
Carlos Ruiz 2015-10-14 20:19:13 -05:00
parent 136b0f147d
commit c6bf87ef05
1 changed files with 10 additions and 0 deletions

View File

@ -563,8 +563,13 @@ public abstract class SvrProcess implements ProcessCall
*/ */
private void unlock () private void unlock ()
{ {
boolean noContext = Env.getCtx().isEmpty() && Env.getCtx().getProperty("#AD_Client_ID") == null;
try try
{ {
//save logging info even if context is lost
if (noContext)
Env.getCtx().put("#AD_Client_ID", m_pi.getAD_Client_ID());
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null); MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0) if (mpi.get_ID() == 0)
{ {
@ -583,6 +588,11 @@ public abstract class SvrProcess implements ProcessCall
{ {
log.severe("unlock() - " + e.getLocalizedMessage()); log.severe("unlock() - " + e.getLocalizedMessage());
} }
finally
{
if (noContext)
Env.getCtx().remove("#AD_Client_ID");
}
} // unlock } // unlock
/** /**