mirror of https://github.com/apache/cloudstack.git
Avoid continously to execute jobs from queue within a single execution. To have better transaction isolations between job executions, so that leak of transaction won't go further into other job executions
This commit is contained in:
parent
b77049a651
commit
9c73dab12e
|
|
@ -335,8 +335,11 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
|||
s_logger.trace("Executing " + executor.getClass().getName() + " returns true for job-" + jobId);
|
||||
|
||||
if(executor.getSyncSource() != null) {
|
||||
_queueMgr.purgeItem(executor.getSyncSource().getId());
|
||||
checkQueue(executor.getSyncSource().getQueueId());
|
||||
_queueMgr.purgeItem(executor.getSyncSource().getId());
|
||||
|
||||
// avoid kicking the queue inside job execution context to maintain better transaction
|
||||
// boundaries between job executions
|
||||
// checkQueue(executor.getSyncSource().getQueueId());
|
||||
}
|
||||
} else {
|
||||
if(s_logger.isTraceEnabled())
|
||||
|
|
@ -353,7 +356,9 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
|||
if(executor.getSyncSource() != null) {
|
||||
_queueMgr.purgeItem(executor.getSyncSource().getId());
|
||||
|
||||
checkQueue(executor.getSyncSource().getQueueId());
|
||||
// avoid kicking the queue inside job execution context to maintain better transaction
|
||||
// boundaries between job executions
|
||||
// checkQueue(executor.getSyncSource().getQueueId());
|
||||
}
|
||||
} catch(Throwable ex) {
|
||||
s_logger.fatal("Exception on exception, log it for record", ex);
|
||||
|
|
@ -379,7 +384,7 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
|||
_queueMgr.purgeItem(item.getId());
|
||||
} else {
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("Schedule queued job-" + job.getId());
|
||||
s_logger.debug("Schedule queued job-" + job.getId() + " for execution");
|
||||
|
||||
executor.setFromPreviousSession(fromPreviousSession);
|
||||
executor.setSyncSource(item);
|
||||
|
|
@ -402,8 +407,10 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
|||
+ executor.getSyncSource().getContentType() + "-"
|
||||
+ executor.getSyncSource().getContentId());
|
||||
|
||||
_queueMgr.purgeItem(executor.getSyncSource().getId());
|
||||
checkQueue(executor.getSyncSource().getQueueId());
|
||||
_queueMgr.purgeItem(executor.getSyncSource().getId());
|
||||
|
||||
// avoid kicking the queue inside job execution context
|
||||
// checkQueue(executor.getSyncSource().getQueueId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class SyncQueueManagerImpl implements SyncQueueManager {
|
|||
}
|
||||
} else {
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("There is a pending process in sync queue(id: " + queueId + ")");
|
||||
s_logger.debug("There is a pending process in sync queue(queue id: " + queueId + ")");
|
||||
}
|
||||
txt.commit();
|
||||
} catch(Exception e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue