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
|
||||
public void run() {
|
||||
server.run();
|
||||
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
|
||||
if (server.isSleeping()) {
|
||||
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() {
|
||||
|
|
|
@ -69,6 +69,7 @@ import org.compiere.model.MStore;
|
|||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.server.AdempiereServer;
|
||||
import org.compiere.server.AdempiereServerGroup;
|
||||
import org.compiere.server.AdempiereServerMgr;
|
||||
import org.compiere.server.AdempiereServerMgr.ServerWrapper;
|
||||
|
@ -268,7 +269,32 @@ public class AdempiereMonitor extends HttpServlet
|
|||
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;
|
||||
} // processRunParameter
|
||||
|
|
Loading…
Reference in New Issue