cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [02/12] Isolated the job queue work in its own project
Date Wed, 15 May 2013 17:13:04 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java b/server/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
deleted file mode 100644
index 287ec10..0000000
--- a/server/src/com/cloud/async/dao/SyncQueueItemDaoImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package com.cloud.async.dao;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.async.SyncQueueItemVO;
-import com.cloud.utils.DateUtil;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.Transaction;
-
-@DB
-public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long> implements SyncQueueItemDao {
-    private static final Logger s_logger = Logger.getLogger(SyncQueueItemDaoImpl.class);
-    final GenericSearchBuilder<SyncQueueItemVO, Long> queueIdSearch;
-    
-    public SyncQueueItemDaoImpl() {
-        super();
-        queueIdSearch = createSearchBuilder(Long.class);
-        queueIdSearch.and("contentId", queueIdSearch.entity().getContentId(), Op.EQ);
-        queueIdSearch.and("contentType", queueIdSearch.entity().getContentType(), Op.EQ);
-        queueIdSearch.selectField(queueIdSearch.entity().getId());
-        queueIdSearch.done();
-    }
-
-	@Override
-	public SyncQueueItemVO getNextQueueItem(long queueId) {
-		
-		SearchBuilder<SyncQueueItemVO> sb = createSearchBuilder();
-        sb.and("queueId", sb.entity().getQueueId(), SearchCriteria.Op.EQ);
-        sb.and("lastProcessNumber", sb.entity().getLastProcessNumber(),	SearchCriteria.Op.NULL);
-        sb.done();
-        
-    	SearchCriteria<SyncQueueItemVO> sc = sb.create();
-    	sc.setParameters("queueId", queueId);
-    	
-    	Filter filter = new Filter(SyncQueueItemVO.class, "created", true, 0L, 1L);
-        List<SyncQueueItemVO> l = listBy(sc, filter);
-        if(l != null && l.size() > 0)
-        	return l.get(0);
-    	
-		return null;
-	}
-
-	@Override
-	public List<SyncQueueItemVO> getNextQueueItems(int maxItems) {
-		List<SyncQueueItemVO> l = new ArrayList<SyncQueueItemVO>();
-		
-		String sql = "SELECT i.id, i.queue_id, i.content_type, i.content_id, i.created " +
-					 " FROM sync_queue AS q JOIN sync_queue_item AS i ON q.id = i.queue_id " +
-                     " WHERE i.queue_proc_number IS NULL " +
-					 " GROUP BY q.id " +
-					 " ORDER BY i.id " +
-					 " LIMIT 0, ?";
-
-        Transaction txn = Transaction.currentTxn();
-        PreparedStatement pstmt = null;
-        try {
-            pstmt = txn.prepareAutoCloseStatement(sql);
-            pstmt.setInt(1, maxItems);
-            ResultSet rs = pstmt.executeQuery();
-            while(rs.next()) {
-            	SyncQueueItemVO item = new SyncQueueItemVO();
-            	item.setId(rs.getLong(1));
-            	item.setQueueId(rs.getLong(2));
-            	item.setContentType(rs.getString(3));
-            	item.setContentId(rs.getLong(4));
-            	item.setCreated(DateUtil.parseDateString(TimeZone.getTimeZone("GMT"), rs.getString(5)));
-            	l.add(item);
-            }
-        } catch (SQLException e) {
-        	s_logger.error("Unexpected sql excetpion, ", e);
-        } catch (Throwable e) {
-        	s_logger.error("Unexpected excetpion, ", e);
-        }
-		return l;
-	}
-	
-	@Override
-	public List<SyncQueueItemVO> getActiveQueueItems(Long msid, boolean exclusive) {
-		SearchBuilder<SyncQueueItemVO> sb = createSearchBuilder();
-        sb.and("lastProcessMsid", sb.entity().getLastProcessMsid(),
-    		SearchCriteria.Op.EQ);
-        sb.done();
-        
-    	SearchCriteria<SyncQueueItemVO> sc = sb.create();
-    	sc.setParameters("lastProcessMsid", msid);
-    	
-    	Filter filter = new Filter(SyncQueueItemVO.class, "created", true, null, null);
-    	
-    	if(exclusive)
-    		return lockRows(sc, filter, true);
-        return listBy(sc, filter);
-	}
-
-    @Override
-    public List<SyncQueueItemVO> getBlockedQueueItems(long thresholdMs, boolean exclusive) {
-        Date cutTime = DateUtil.currentGMTTime();
-        
-        SearchBuilder<SyncQueueItemVO> sbItem = createSearchBuilder();
-        sbItem.and("lastProcessMsid", sbItem.entity().getLastProcessMsid(), SearchCriteria.Op.NNULL);
-        sbItem.and("lastProcessNumber", sbItem.entity().getLastProcessNumber(), SearchCriteria.Op.NNULL);
-        sbItem.and("lastProcessNumber", sbItem.entity().getLastProcessTime(), SearchCriteria.Op.NNULL);
-        sbItem.and("lastProcessTime2", sbItem.entity().getLastProcessTime(), SearchCriteria.Op.LT);
-        
-        sbItem.done();
-        
-        SearchCriteria<SyncQueueItemVO> sc = sbItem.create();
-        sc.setParameters("lastProcessTime2", new Date(cutTime.getTime() - thresholdMs));
-        
-        if(exclusive)
-            return lockRows(sc, null, true);
-        return listBy(sc, null);
-    }
-
-    @Override
-    public Long getQueueItemIdByContentIdAndType(long contentId, String contentType) {
-        SearchCriteria<Long> sc = queueIdSearch.create();
-        sc.setParameters("contentId", contentId);
-        sc.setParameters("contentType", contentType);
-        List<Long> id = customSearch(sc, null);
-
-        return id.size() == 0 ? null : id.get(0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 5950a99..b7cfaca 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -33,6 +33,7 @@ import org.apache.log4j.Logger;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
@@ -49,7 +50,6 @@ import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
-import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.certificate.dao.CertificateDao;
 import com.cloud.cluster.ClusterManager;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 612a4a0..aeb5d64 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -406,6 +406,9 @@ import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
@@ -422,10 +425,7 @@ import com.cloud.alert.AlertManager;
 import com.cloud.alert.AlertVO;
 import com.cloud.alert.dao.AlertDao;
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityVO;
 import com.cloud.capacity.dao.CapacityDao;
@@ -3425,7 +3425,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             s_logger.debug("Extract Mode - " + uploadJob.getMode());
             uploadJob = _uploadDao.createForUpdate(uploadJob.getId());
 
-            // Update the async Job
+            // Update the async AsyncJob
 
             ExtractResponse resultObj = new ExtractResponse(ApiDBUtils.findVolumeById(volumeId).getUuid(),
                     volume.getName(), ApiDBUtils.findAccountById(accountId).getUuid(), UploadVO.Status.COPY_IN_PROGRESS.toString(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 1d4dcef..80f0712 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -64,6 +64,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
@@ -81,7 +82,6 @@ import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.manager.Commands;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityManager;
 import com.cloud.capacity.CapacityState;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index dfeb84d..e27d222 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -25,10 +25,10 @@ import java.net.URISyntaxException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
@@ -36,6 +36,9 @@ import java.util.concurrent.ExecutionException;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
 import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
@@ -61,10 +64,10 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -74,8 +77,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.api.to.VolumeTO;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.capacity.CapacityManager;
 import com.cloud.capacity.dao.CapacityDao;
@@ -108,9 +109,9 @@ import com.cloud.host.Host;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.HypervisorCapabilitiesVO;
 import com.cloud.hypervisor.HypervisorGuruManager;
 import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
-import com.cloud.hypervisor.HypervisorCapabilitiesVO;
 import com.cloud.network.NetworkModel;
 import com.cloud.org.Grouping;
 import com.cloud.resource.ResourceManager;
@@ -321,7 +322,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
     @Inject
     StorageManager storageMgr;
     private int _customDiskOfferingMinSize = 1;
-    private int _customDiskOfferingMaxSize = 1024;
+    private final int _customDiskOfferingMaxSize = 1024;
     private long _maxVolumeSizeInGb;
     private boolean _recreateSystemVmEnabled;
     protected SearchBuilder<VMTemplateHostVO> HostTemplateStatesSearch;
@@ -358,7 +359,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         }
         
         Volume newVol = migrateVolume(volume, destPool);
-        return this.volFactory.getVolume(newVol.getId());
+        return volFactory.getVolume(newVol.getId());
     }
 
     /*
@@ -376,20 +377,20 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         String url = cmd.getUrl();
         String format = cmd.getFormat();
         String imageStoreUuid = cmd.getImageStoreUuid();
-        DataStore store = this._tmpltMgr.getImageStore(imageStoreUuid, zoneId);
+        DataStore store = _tmpltMgr.getImageStore(imageStoreUuid, zoneId);
 
         validateVolume(caller, ownerId, zoneId, volumeName, url, format);
         
         VolumeVO volume = persistVolume(caller, ownerId, zoneId, volumeName,
                 url, cmd.getFormat());
         
-        VolumeInfo vol = this.volFactory.getVolume(volume.getId());
+        VolumeInfo vol = volFactory.getVolume(volume.getId());
         
         RegisterVolumePayload payload = new RegisterVolumePayload(cmd.getUrl(), cmd.getChecksum(),
                 cmd.getFormat());
         vol.addPayload(payload);
         
-        this.volService.registerVolume(vol, store);
+        volService.registerVolume(vol, store);
         return volume;
     }
 
@@ -532,10 +533,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
             }
         }
         
-        VolumeInfo vol = this.volFactory.getVolume(volume.getId());
-        DataStore store = this.dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
-        SnapshotInfo snapInfo = this.snapshotFactory.getSnapshot(snapshot.getId());
-        AsyncCallFuture<VolumeApiResult> future = this.volService.createVolumeFromSnapshot(vol, store, snapInfo);
+        VolumeInfo vol = volFactory.getVolume(volume.getId());
+        DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
+        SnapshotInfo snapInfo = snapshotFactory.getSnapshot(snapshot.getId());
+        AsyncCallFuture<VolumeApiResult> future = volService.createVolumeFromSnapshot(vol, store, snapInfo);
         try {
             VolumeApiResult result = future.get();
             if (result.isFailed()) {
@@ -592,7 +593,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     protected VolumeVO createVolumeFromSnapshot(VolumeVO volume, long snapshotId) {
         VolumeInfo createdVolume = null;
-        SnapshotVO snapshot = _snapshotDao.findById(snapshotId); 
+        SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
         createdVolume = createVolumeFromSnapshot(volume,
                 snapshot);
 
@@ -604,7 +605,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                 null, createdVolume.getSize());
         _usageEventDao.persist(usageEvent);
 
-        return this._volsDao.findById(createdVolume.getId());
+        return _volsDao.findById(createdVolume.getId());
     }
 
     @DB
@@ -622,15 +623,15 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         // Find a suitable storage to create volume on
         StoragePool destPool = storageMgr.findStoragePool(dskCh, dc, pod,
                 clusterId, null, vm, avoidPools);
-        DataStore destStore = this.dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary);
-        AsyncCallFuture<VolumeApiResult> future = this.volService.copyVolume(volume, destStore);
+        DataStore destStore = dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary);
+        AsyncCallFuture<VolumeApiResult> future = volService.copyVolume(volume, destStore);
 
         try {
             VolumeApiResult result = future.get();
             if (result.isFailed()) {
                 s_logger.debug("copy volume failed: " + result.getResult());
                 throw new CloudRuntimeException("copy volume failed: " + result.getResult());
-            } 
+            }
             return result.getVolume();
         } catch (InterruptedException e) {
             s_logger.debug("Failed to copy volume: " + volume.getId(), e);
@@ -678,14 +679,14 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Trying to create " + volume + " on " + pool);
         }
-        DataStore store = this.dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
+        DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
         AsyncCallFuture<VolumeApiResult> future = null;
         boolean isNotCreatedFromTemplate = volume.getTemplateId() == null ? true : false;
         if (isNotCreatedFromTemplate) {
-            future = this.volService.createVolumeAsync(volume, store);
+            future = volService.createVolumeAsync(volume, store);
         } else {
-            TemplateInfo templ = this.tmplFactory.getTemplate(template.getId());
-            future = this.volService.createVolumeFromTemplateAsync(volume, store.getId(), templ);
+            TemplateInfo templ = tmplFactory.getTemplate(template.getId());
+            future = volService.createVolumeFromTemplateAsync(volume, store.getId(), templ);
         }
         try {
             VolumeApiResult result = future.get();
@@ -1155,7 +1156,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
         UserVmVO userVm = _userVmDao.findById(volume.getInstanceId());
 
-        PrimaryDataStoreInfo pool = (PrimaryDataStoreInfo)this.dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary);
+        PrimaryDataStoreInfo pool = (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary);
         long currentSize = volume.getSize();
 
         /*
@@ -1206,10 +1207,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         ResizeVolumePayload payload = new ResizeVolumePayload(newSize, shrinkOk, instanceName, hosts);
         
         try {
-            VolumeInfo vol = this.volFactory.getVolume(volume.getId());
+            VolumeInfo vol = volFactory.getVolume(volume.getId());
             vol.addPayload(payload);
 
-            AsyncCallFuture<VolumeApiResult> future = this.volService.resize(vol);
+            AsyncCallFuture<VolumeApiResult> future = volService.resize(vol);
             future.get();
             volume = _volsDao.findById(volume.getId());
 
@@ -1274,11 +1275,11 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         try {
             if (volume.getState() != Volume.State.Destroy && volume.getState() != Volume.State.Expunging && volume.getState() != Volume.State.Expunging) {
                 Long instanceId = volume.getInstanceId();
-                if (!this.volService.destroyVolume(volume.getId())) {
+                if (!volService.destroyVolume(volume.getId())) {
                     return false;
                 }
                 
-                VMInstanceVO vmInstance = this._vmInstanceDao.findById(instanceId);
+                VMInstanceVO vmInstance = _vmInstanceDao.findById(instanceId);
                 if (instanceId == null
                         || (vmInstance.getType().equals(VirtualMachine.Type.User))) {
                     // Decrement the resource count for volumes and primary storage belonging user VM's only
@@ -1301,7 +1302,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                     _usageEventDao.persist(usageEvent);
                 }
             }
-            AsyncCallFuture<VolumeApiResult> future = this.volService.expungeVolumeAsync(this.volFactory.getVolume(volume.getId()));
+            AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volFactory.getVolume(volume.getId()));
             future.get();
             
         } catch (Exception e) {
@@ -1377,7 +1378,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
             VMTemplateVO template, VMInstanceVO vm, Account owner) {
         assert (template.getFormat() != ImageFormat.ISO) : "ISO is not a template really....";
 
-        Long size = this._tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
+        Long size = _tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
 
         VolumeVO vol = new VolumeVO(type, name, vm.getDataCenterId(),
                 owner.getDomainId(), owner.getId(), offering.getId(), size);
@@ -1499,8 +1500,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
     }
 
     private boolean needMoveVolume(VolumeVO rootVolumeOfVm, VolumeInfo volume) {
-        DataStore storeForRootVol = this.dataStoreMgr.getPrimaryDataStore(rootVolumeOfVm.getPoolId());
-        DataStore storeForDataVol = this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
+        DataStore storeForRootVol = dataStoreMgr.getPrimaryDataStore(rootVolumeOfVm.getPoolId());
+        DataStore storeForDataVol = dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
         
         Scope storeForRootStoreScope = storeForRootVol.getScope();
         if (storeForRootStoreScope == null) {
@@ -1681,7 +1682,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.findByVm(vmId);
         if(vmSnapshots.size() > 0){
             throw new InvalidParameterValueException(
-                    "Unable to attach volume, please specify a VM that does not have VM snapshots");           
+                    "Unable to attach volume, please specify a VM that does not have VM snapshots");
         }
         
         // permission check
@@ -1834,7 +1835,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         }
 
         // Check that the VM is in the correct state
-        UserVmVO vm = this._userVmDao.findById(vmId);
+        UserVmVO vm = _userVmDao.findById(vmId);
         if (vm.getState() != State.Running && vm.getState() != State.Stopped
                 && vm.getState() != State.Destroyed) {
             throw new InvalidParameterValueException(
@@ -1970,7 +1971,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                 // This check is for VM in Error state (volume is already
                 // destroyed)
                 if (!vol.getState().equals(Volume.State.Destroy)) {
-                    this.volService.destroyVolume(vol.getId());
+                    volService.destroyVolume(vol.getId());
                 }
                 toBeExpunged.add(vol);
             } else {
@@ -1983,7 +1984,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         txn.commit();
         AsyncCallFuture<VolumeApiResult> future = null;
         for (VolumeVO expunge : toBeExpunged) {
-            future = this.volService.expungeVolumeAsync(this.volFactory.getVolume(expunge.getId()));
+            future = volService.expungeVolumeAsync(volFactory.getVolume(expunge.getId()));
             try {
                 future.get();
             } catch (InterruptedException e) {
@@ -2046,7 +2047,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                     "the parameter livemigrate should be specified");
         }
 
-        StoragePool destPool = (StoragePool)this.dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
+        StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
         if (destPool == null) {
             throw new InvalidParameterValueException(
                     "Failed to find the destination storage pool: "
@@ -2069,8 +2070,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     @DB
     protected Volume migrateVolume(Volume volume, StoragePool destPool) {
-        VolumeInfo vol = this.volFactory.getVolume(volume.getId());
-        AsyncCallFuture<VolumeApiResult> future = this.volService.copyVolume(vol, (DataStore)destPool);
+        VolumeInfo vol = volFactory.getVolume(volume.getId());
+        AsyncCallFuture<VolumeApiResult> future = volService.copyVolume(vol, (DataStore)destPool);
         try {
             VolumeApiResult result = future.get();
             if (result.isFailed()) {
@@ -2089,8 +2090,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     @DB
     protected Volume liveMigrateVolume(Volume volume, StoragePool destPool) {
-        VolumeInfo vol = this.volFactory.getVolume(volume.getId());
-        AsyncCallFuture<VolumeApiResult> future = this.volService.migrateVolume(vol, (DataStore)destPool);
+        VolumeInfo vol = volFactory.getVolume(volume.getId());
+        AsyncCallFuture<VolumeApiResult> future = volService.migrateVolume(vol, (DataStore)destPool);
         try {
             VolumeApiResult result = future.get();
             if (result.isFailed()) {
@@ -2117,7 +2118,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         for (Map.Entry<VolumeVO, StoragePoolVO> entry : volumeToPool.entrySet()) {
             VolumeVO volume = entry.getKey();
             StoragePoolVO storagePool = entry.getValue();
-            StoragePool destPool = (StoragePool)this.dataStoreMgr.getDataStore(storagePool.getId(),
+            StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(storagePool.getId(),
                     DataStoreRole.Primary);
 
             if (volume.getInstanceId() != vm.getId()) {
@@ -2129,10 +2130,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                 throw new CloudRuntimeException("Failed to find the destination storage pool " + storagePool.getId());
             }
 
-            volumeMap.put(this.volFactory.getVolume(volume.getId()), (DataStore)destPool);
+            volumeMap.put(volFactory.getVolume(volume.getId()), (DataStore)destPool);
         }
 
-        AsyncCallFuture<CommandResult> future = this.volService.migrateVolumes(volumeMap, vmTo, srcHost, destHost);
+        AsyncCallFuture<CommandResult> future = volService.migrateVolumes(volumeMap, vmTo, srcHost, destHost);
         try {
             CommandResult result = future.get();
             if (result.isFailed()) {
@@ -2195,14 +2196,14 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         }
 
         for (VolumeVO vol : vols) {
-            PrimaryDataStoreInfo pool = (PrimaryDataStoreInfo)this.dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary);
+            PrimaryDataStoreInfo pool = (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary);
             vm.addDisk(new VolumeTO(vol, pool));
         }
 
         if (vm.getType() == VirtualMachine.Type.User) {
             UserVmVO userVM = (UserVmVO) vm.getVirtualMachine();
             if (userVM.getIsoId() != null) {
-                Pair<String, String> isoPathPair = this._tmpltMgr.getAbsoluteIsoPath(
+                Pair<String, String> isoPathPair = _tmpltMgr.getAbsoluteIsoPath(
                         userVM.getIsoId(), userVM.getDataCenterId());
                 if (isoPathPair != null) {
                     String isoPath = isoPathPair.first();
@@ -2324,7 +2325,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         return tasks;
     }
     
-    private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachineProfile<? extends VirtualMachine> vm,
             DeployDestination dest) throws StorageUnavailableException {
         VolumeVO newVol;
         boolean recreate = _recreateSystemVmEnabled;
@@ -2362,10 +2363,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         Long templateId = newVol.getTemplateId();
         AsyncCallFuture<VolumeApiResult> future = null;
         if (templateId == null) {
-            future = this.volService.createVolumeAsync(volume, destPool);
+            future = volService.createVolumeAsync(volume, destPool);
         } else {
-            TemplateInfo templ = this.tmplFactory.getTemplate(templateId);
-            future = this.volService.createVolumeFromTemplateAsync(volume, destPool.getId(), templ);
+            TemplateInfo templ = tmplFactory.getTemplate(templateId);
+            future = volService.createVolumeFromTemplateAsync(volume, destPool.getId(), templ);
         }
         VolumeApiResult result = null;
         try {
@@ -2376,7 +2377,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                 throw new StorageUnavailableException("Unable to create "
                         + newVol + ":" + result.getResult(), destPool.getId());
             }
-            newVol = this._volsDao.findById(newVol.getId());
+            newVol = _volsDao.findById(newVol.getId());
         } catch (InterruptedException e) {
             s_logger.error("Unable to create " + newVol, e);
             throw new StorageUnavailableException("Unable to create "
@@ -2575,7 +2576,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
     @Override
     public void destroyVolume(VolumeVO volume) {
         try {
-            this.volService.destroyVolume(volume.getId());
+            volService.destroyVolume(volume.getId());
         } catch (ConcurrentOperationException e) {
             s_logger.debug("Failed to destroy volume" + volume.getId(), e);
             throw new CloudRuntimeException("Failed to destroy volume" + volume.getId(), e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index c12d035..5dc66f9 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -31,6 +31,8 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -49,7 +51,6 @@ import com.cloud.agent.api.check.CheckSshCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
-import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.capacity.dao.CapacityDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index b8b0195..851ec86 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -33,14 +33,15 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+import org.apache.cloudstack.framework.jobs.AsyncJobVO;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobDao;
+
 import com.cloud.api.ApiDispatcher;
 import com.cloud.api.ApiGsonHelper;
 import com.cloud.user.Account;
-import com.cloud.async.AsyncJobConstants;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
-import com.cloud.async.AsyncJobVO;
-import com.cloud.async.dao.AsyncJobDao;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.event.EventTypes;
 import com.cloud.storage.Snapshot;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/upload/UploadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadListener.java b/server/src/com/cloud/storage/upload/UploadListener.java
index c333789..b66624d 100755
--- a/server/src/com/cloud/storage/upload/UploadListener.java
+++ b/server/src/com/cloud/storage/upload/UploadListener.java
@@ -42,10 +42,10 @@ import com.cloud.agent.api.storage.UploadProgressCommand;
 import com.cloud.agent.api.storage.UploadProgressCommand.RequestType;
 import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJobConstants;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.host.HostVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/upload/UploadMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitor.java b/server/src/com/cloud/storage/upload/UploadMonitor.java
index 1c3590e..d4f5762 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitor.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitor.java
@@ -17,7 +17,8 @@
 package com.cloud.storage.upload;
 
 
-import com.cloud.async.AsyncJobManager;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+
 import com.cloud.host.HostVO;
 import com.cloud.storage.Upload.Mode;
 import com.cloud.storage.Upload.Status;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
index 77f0d20..103766e 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
@@ -35,6 +35,8 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.Listener;
 import com.cloud.agent.api.Command;
@@ -44,7 +46,6 @@ import com.cloud.agent.api.storage.UploadCommand;
 import com.cloud.agent.api.storage.UploadProgressCommand.RequestType;
 import com.cloud.agent.manager.Commands;
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.host.Host;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index a8729e1..747ed25 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -66,6 +66,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+import org.apache.cloudstack.framework.jobs.AsyncJobVO;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
@@ -83,8 +85,6 @@ import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
 import com.cloud.agent.api.to.SwiftTO;
 
 import com.cloud.api.ApiDBUtils;
-import com.cloud.async.AsyncJobManager;
-import com.cloud.async.AsyncJobVO;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.configuration.dao.ConfigurationDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 245e804..28cdb7c 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -57,6 +57,7 @@ import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
 import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
 import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity;
 import org.apache.cloudstack.engine.service.api.OrchestrationService;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.commons.codec.binary.Base64;
@@ -82,7 +83,6 @@ import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.dao.UserVmJoinDao;
 import com.cloud.api.query.vo.UserVmJoinVO;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.capacity.CapacityManager;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 752eb73..28b7d9c 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -37,6 +37,9 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.framework.messagebus.MessageBus;
 import org.apache.cloudstack.messagebus.TopicConstants;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -67,10 +70,7 @@ import com.cloud.agent.manager.Commands;
 import com.cloud.agent.manager.allocator.HostAllocator;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.capacity.CapacityManager;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.Config;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/VmWorkJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobDaoImpl.java b/server/src/com/cloud/vm/VmWorkJobDaoImpl.java
index 641d9d9..53c76ed 100644
--- a/server/src/com/cloud/vm/VmWorkJobDaoImpl.java
+++ b/server/src/com/cloud/vm/VmWorkJobDaoImpl.java
@@ -21,7 +21,8 @@ import java.util.List;
 
 import javax.annotation.PostConstruct;
 
-import com.cloud.async.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GenericDaoBase;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobDispatcher.java b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
index 8742169..6303ab5 100644
--- a/server/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -24,11 +24,12 @@ import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobConstants;
-import com.cloud.async.AsyncJobDispatcher;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.user.AccountVO;
 import com.cloud.user.UserContext;
 import com.cloud.user.dao.AccountDao;
@@ -43,10 +44,10 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
     @Inject private AccountDao _accountDao;
     @Inject private VMInstanceDao _instanceDao;
     
-    private Map<String, Method> _handlerMap = new HashMap<String, Method>();
+    private final Map<String, Method> _handlerMap = new HashMap<String, Method>();
 
 	@Override
-	public void runJob(AsyncJob job) {
+    public void runJob(AsyncJob job) {
         try {
         	String cmd = job.getCmd();
         	assert(cmd != null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/VmWorkJobVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobVO.java b/server/src/com/cloud/vm/VmWorkJobVO.java
index 1fc89a9..8cea54f 100644
--- a/server/src/com/cloud/vm/VmWorkJobVO.java
+++ b/server/src/com/cloud/vm/VmWorkJobVO.java
@@ -24,7 +24,8 @@ import javax.persistence.Enumerated;
 import javax.persistence.PrimaryKeyJoinColumn;
 import javax.persistence.Table;
 
-import com.cloud.async.AsyncJobVO;
+import org.apache.cloudstack.framework.jobs.AsyncJobVO;
+
 
 @Entity
 @Table(name="vm_work_job")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
index 7447df6..08584ed 100644
--- a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
+++ b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
@@ -26,11 +26,12 @@ import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
+import org.apache.cloudstack.framework.jobs.AsyncJobJoinMapVO;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao;
+
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobDispatcher;
-import com.cloud.async.AsyncJobJoinMapVO;
-import com.cloud.async.dao.AsyncJobJoinMapDao;
 import com.cloud.user.AccountVO;
 import com.cloud.user.UserContext;
 import com.cloud.user.dao.AccountDao;
@@ -46,14 +47,14 @@ public class VmWorkJobWakeupDispatcher extends AdapterBase implements AsyncJobDi
     @Inject private VMInstanceDao _instanceDao;
     @Inject private VirtualMachineManager _vmMgr;
 
-    private Map<String, Method> _handlerMap = new HashMap<String, Method>();
+    private final Map<String, Method> _handlerMap = new HashMap<String, Method>();
     
 	@Override
-	public void runJob(AsyncJob job) {
+    public void runJob(AsyncJob job) {
 		try {
 			List<AsyncJobJoinMapVO> joinRecords =_joinMapDao.listJoinRecords(job.getId());
 			if(joinRecords.size() != 1) {
-				s_logger.warn("Job-" + job.getId() 
+                s_logger.warn("AsyncJob-" + job.getId()
 				    + " received wakeup call with un-supported joining job number: " + joinRecords.size());
 
 				// if we fail wakeup-execution for any reason, avoid release sync-source if there is any

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/test/com/cloud/vm/VmWorkMockVirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkMockVirtualMachineManagerImpl.java b/server/test/com/cloud/vm/VmWorkMockVirtualMachineManagerImpl.java
index 4f992d9..681b6b3 100644
--- a/server/test/com/cloud/vm/VmWorkMockVirtualMachineManagerImpl.java
+++ b/server/test/com/cloud/vm/VmWorkMockVirtualMachineManagerImpl.java
@@ -26,12 +26,12 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
 import org.apache.cloudstack.framework.messagebus.MessageBus;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/test/com/cloud/vm/VmWorkTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkTest.java b/server/test/com/cloud/vm/VmWorkTest.java
index 7c427b2..4f91aba 100644
--- a/server/test/com/cloud/vm/VmWorkTest.java
+++ b/server/test/com/cloud/vm/VmWorkTest.java
@@ -35,8 +35,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import junit.framework.TestCase;
 
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.async.AsyncJobManager;
-import com.cloud.async.AsyncJobVO;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeploymentPlan;
@@ -51,6 +49,9 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.vm.VmWorkJobVO.Step;
 import com.google.gson.Gson;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+import org.apache.cloudstack.framework.jobs.AsyncJobVO;
+
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations="classpath:/VmWorkTestContext.xml")
 public class VmWorkTest extends TestCase {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java b/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java
index 02d634c..5166372 100644
--- a/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java
+++ b/server/test/com/cloud/vm/VmWorkTestApiJobDispatcher.java
@@ -22,11 +22,12 @@ import java.sql.Statement;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
+import org.apache.cloudstack.framework.jobs.AsyncJobManager;
+
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobDispatcher;
 import com.cloud.async.AsyncJobExecutionContext;
-import com.cloud.async.AsyncJobManager;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.Transaction;
 
@@ -35,7 +36,7 @@ public class VmWorkTestApiJobDispatcher extends AdapterBase implements AsyncJobD
 	@Inject AsyncJobManager _jobMgr;
 	
 	@Override
-	public void runJob(AsyncJob job) {
+    public void runJob(AsyncJob job) {
 		
 		// drop constraint check in order to do single table test
 		Statement stat = null;
@@ -74,9 +75,9 @@ public class VmWorkTestApiJobDispatcher extends AdapterBase implements AsyncJobD
 		
 		_jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, 1L);
 		
-		_jobMgr.joinJob(job.getId(), workJob.getId(), "processVmStartWakeup", 
-				VmWorkConstants.VM_WORK_JOB_WAKEUP_DISPATCHER, 
-				new String[] {}, 
+		_jobMgr.joinJob(job.getId(), workJob.getId(), "processVmStartWakeup",
+				VmWorkConstants.VM_WORK_JOB_WAKEUP_DISPATCHER,
+				new String[] {},
 				3000, 120000);
 		AsyncJobExecutionContext.getCurrentExecutionContext().resetSyncSource();
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/test/com/cloud/vm/VmWorkTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkTestConfiguration.java b/server/test/com/cloud/vm/VmWorkTestConfiguration.java
index 93aa41a..9db06f8 100644
--- a/server/test/com/cloud/vm/VmWorkTestConfiguration.java
+++ b/server/test/com/cloud/vm/VmWorkTestConfiguration.java
@@ -20,20 +20,21 @@ import org.mockito.Mockito;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
+import org.apache.cloudstack.framework.jobs.AsyncJobMonitor;
+import org.apache.cloudstack.framework.jobs.SyncQueueManager;
+import org.apache.cloudstack.framework.jobs.SyncQueueManagerImpl;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobDao;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobDaoImpl;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDaoImpl;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobJournalDao;
+import org.apache.cloudstack.framework.jobs.dao.AsyncJobJournalDaoImpl;
+import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao;
+import org.apache.cloudstack.framework.jobs.dao.SyncQueueDaoImpl;
+import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao;
+import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDaoImpl;
+
 import com.cloud.api.ApiDispatcher;
-import com.cloud.async.AsyncJobMonitor;
-import com.cloud.async.SyncQueueManager;
-import com.cloud.async.SyncQueueManagerImpl;
-import com.cloud.async.dao.AsyncJobDao;
-import com.cloud.async.dao.AsyncJobDaoImpl;
-import com.cloud.async.dao.AsyncJobJoinMapDao;
-import com.cloud.async.dao.AsyncJobJoinMapDaoImpl;
-import com.cloud.async.dao.AsyncJobJournalDao;
-import com.cloud.async.dao.AsyncJobJournalDaoImpl;
-import com.cloud.async.dao.SyncQueueDao;
-import com.cloud.async.dao.SyncQueueDaoImpl;
-import com.cloud.async.dao.SyncQueueItemDao;
-import com.cloud.async.dao.SyncQueueItemDaoImpl;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.dao.ConfigurationDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbdc4063/server/test/com/cloud/vm/VmWorkTestWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VmWorkTestWorkJobDispatcher.java b/server/test/com/cloud/vm/VmWorkTestWorkJobDispatcher.java
index 8e9990b..288b793 100644
--- a/server/test/com/cloud/vm/VmWorkTestWorkJobDispatcher.java
+++ b/server/test/com/cloud/vm/VmWorkTestWorkJobDispatcher.java
@@ -2,9 +2,10 @@ package com.cloud.vm;
 
 import org.apache.log4j.Logger;
 
-import com.cloud.async.AsyncJob;
-import com.cloud.async.AsyncJobConstants;
-import com.cloud.async.AsyncJobDispatcher;
+import org.apache.cloudstack.framework.jobs.AsyncJob;
+import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
+import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
+
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.utils.component.AdapterBase;
 
@@ -12,7 +13,7 @@ public class VmWorkTestWorkJobDispatcher extends AdapterBase implements AsyncJob
     public static final Logger s_logger = Logger.getLogger(VmWorkTestWorkJobDispatcher.class);
 
 	@Override
-	public void runJob(AsyncJob job) {
+    public void runJob(AsyncJob job) {
 		s_logger.info("Begin work job execution. job-" + job.getId());
 		try {
 			Thread.sleep(120000);


Mime
View raw message