IDEMPIERE-3676 Incorrect stop of the schedulers (#280)

Base on patch from NikColonel<polkneket@gmail.com>
This commit is contained in:
Carlos Ruiz 2020-10-01 19:15:45 +02:00 committed by GitHub
commit 72e13cf1f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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