IDEMPIERE-3676 Incorrect stop of the schedulers

Base on patch from NikColonel<polkneket@gmail.com>
This commit is contained in:
hengsin 2020-10-01 17:23:40 +08:00
parent 36f03b701a
commit e01e8a0f41
2 changed files with 9 additions and 3 deletions

View File

@ -620,7 +620,11 @@ public abstract class SvrProcess implements ProcessCall
//save logging info even if context is lost
if (noContext)
Env.getCtx().put("#AD_Client_ID", m_pi.getAD_Client_ID());
//clear interrupt signal so that we can unlock the ad_pinstance record
if (Thread.currentThread().isInterrupted())
Thread.interrupted();
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0)
{

View File

@ -730,8 +730,10 @@ public class AdempiereServerMgr implements ServiceTrackerCustomizer<IServerFacto
public void run() {
if (server.isSleeping()) {
server.run();
if (server.getSleepMS() != 0) {
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
if (!isInterrupted()) {
if (server.getSleepMS() != 0) {
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
}
}
} else {
//server busy, try again after one minute