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

@ -621,6 +621,10 @@ public abstract class SvrProcess implements ProcessCall
if (noContext) if (noContext)
Env.getCtx().put("#AD_Client_ID", m_pi.getAD_Client_ID()); 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); MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0) if (mpi.get_ID() == 0)
{ {

View File

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