cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [15/22] git commit: updated refs/heads/4.5 to 78b9be0
Date Thu, 05 Feb 2015 11:51:51 GMT
jobs: fix corner cases, add NPE checks

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/46cd98b1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/46cd98b1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/46cd98b1

Branch: refs/heads/4.5
Commit: 46cd98b163ea6f4603a0c74ab5f83cfdd4aa9542
Parents: 744c20b
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Thu Feb 5 16:20:08 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Thu Feb 5 16:20:47 2015 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java | 2 ++
 .../cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java       | 2 +-
 .../cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java      | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46cd98b1/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index a050407..6889cd2 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -64,6 +64,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long>
implements
         pendingAsyncJobsSearch.done();
 
         expiringUnfinishedAsyncJobSearch = createSearchBuilder();
+        expiringUnfinishedAsyncJobSearch.and("jobDispatcher", expiringUnfinishedAsyncJobSearch.entity().getDispatcher(),
SearchCriteria.Op.NEQ);
         expiringUnfinishedAsyncJobSearch.and("created", expiringUnfinishedAsyncJobSearch.entity().getCreated(),
SearchCriteria.Op.LTEQ);
         expiringUnfinishedAsyncJobSearch.and("completeMsId", expiringUnfinishedAsyncJobSearch.entity().getCompleteMsid(),
SearchCriteria.Op.NULL);
         expiringUnfinishedAsyncJobSearch.and("jobStatus", expiringUnfinishedAsyncJobSearch.entity().getStatus(),
SearchCriteria.Op.EQ);
@@ -159,6 +160,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long>
implements
     @Override
     public List<AsyncJobVO> getExpiredUnfinishedJobs(Date cutTime, int limit) {
         SearchCriteria<AsyncJobVO> sc = expiringUnfinishedAsyncJobSearch.create();
+        sc.setParameters("jobDispatcher", AsyncJobVO.JOB_DISPATCHER_PSEUDO);
         sc.setParameters("created", cutTime);
         sc.setParameters("jobStatus", JobInfo.Status.IN_PROGRESS);
         Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46cd98b1/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index bdc7cb0..89e0800 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -673,7 +673,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             while (timeoutInMiliseconds < 0 || System.currentTimeMillis() - startTick
< timeoutInMiliseconds) {
                 msgDetector.waitAny(checkIntervalInMilliSeconds);
                 job = _jobDao.findById(job.getId());
-                if (job.getStatus().done()) {
+                if (job != null && job.getStatus().done()) {
                     return true;
                 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46cd98b1/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
index 1cfec4d..6535163 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
@@ -142,7 +142,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage
                         for(SyncQueueItemVO item : l) {
                             SyncQueueVO queueVO = _syncQueueDao.findById(item.getQueueId());
                             SyncQueueItemVO itemVO = _syncQueueItemDao.findById(item.getId());
-                            if(queueReadyToProcess(queueVO) && itemVO.getLastProcessNumber()
== null) {
+                            if(queueReadyToProcess(queueVO) && itemVO != null &&
itemVO.getLastProcessNumber() == null) {
                                 Long processNumber = queueVO.getLastProcessNumber();
                                 if (processNumber == null)
                                     processNumber = new Long(1);
@@ -220,6 +220,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage
                         itemVO.setLastProcessTime(null);
                         _syncQueueItemDao.update(queueItemId, itemVO);
 
+                        queueVO.setQueueSize(queueVO.getQueueSize() - 1);
                         queueVO.setLastUpdated(DateUtil.currentGMTTime());
                         _syncQueueDao.update(queueVO.getId(), queueVO);
                     }


Mime
View raw message