IDEMPIERE-3382 Schedule process shouldn't allow concurrent execution
This commit is contained in:
parent
f01e4cac14
commit
d12e72aec3
|
@ -501,8 +501,13 @@ public class AdempiereServerMgr implements ServiceTrackerCustomizer<IServerFacto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
server.run();
|
if (server.isSleeping()) {
|
||||||
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
|
server.run();
|
||||||
|
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
|
||||||
|
} else {
|
||||||
|
//server busy, try again after one minute
|
||||||
|
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, 60 * 1000, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdempiereServer getServer() {
|
public AdempiereServer getServer() {
|
||||||
|
|
|
@ -69,6 +69,7 @@ import org.compiere.model.MStore;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MSystem;
|
import org.compiere.model.MSystem;
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
|
import org.compiere.server.AdempiereServer;
|
||||||
import org.compiere.server.AdempiereServerGroup;
|
import org.compiere.server.AdempiereServerGroup;
|
||||||
import org.compiere.server.AdempiereServerMgr;
|
import org.compiere.server.AdempiereServerMgr;
|
||||||
import org.compiere.server.AdempiereServerMgr.ServerWrapper;
|
import org.compiere.server.AdempiereServerMgr.ServerWrapper;
|
||||||
|
@ -268,7 +269,32 @@ public class AdempiereMonitor extends HttpServlet
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
server.getServer().runNow();
|
AdempiereServer serverInstance = server.getServer();
|
||||||
|
if (serverInstance.isSleeping())
|
||||||
|
{
|
||||||
|
serverInstance.runNow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
while(!serverInstance.isSleeping() && count < 5)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
try {
|
||||||
|
Thread.sleep(60000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.interrupted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (serverInstance.isSleeping())
|
||||||
|
serverInstance.runNow();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_message = new p();
|
||||||
|
m_message.addElement(new strong("Timeout waiting for server process to be available for execution."));
|
||||||
|
m_message.addElement(serverID);
|
||||||
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
return true;
|
return true;
|
||||||
} // processRunParameter
|
} // processRunParameter
|
||||||
|
|
Loading…
Reference in New Issue