mirror of https://github.com/apache/cloudstack.git
Async job management cleanup
This commit is contained in:
parent
1b81979956
commit
5585b5ea6e
|
|
@ -32,7 +32,6 @@ import javax.persistence.TemporalType;
|
|||
import javax.persistence.Transient;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
@Entity
|
||||
@Table(name="async_job")
|
||||
|
|
@ -120,7 +119,6 @@ public class AsyncJobVO implements AsyncJob {
|
|||
@Transient
|
||||
private boolean fromPreviousSession = false;
|
||||
|
||||
|
||||
public AsyncJobVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +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;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.async.dao.AsyncJobDao;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.snapshot.SnapshotManager;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.vm.UserVmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
public interface AsyncJobExecutorContext extends Manager {
|
||||
public ManagementServer getManagementServer();
|
||||
public AgentManager getAgentMgr();
|
||||
public NetworkModel getNetworkMgr();
|
||||
public UserVmManager getVmMgr();
|
||||
public SnapshotManager getSnapshotMgr();
|
||||
public AccountManager getAccountMgr();
|
||||
public StorageManager getStorageMgr();
|
||||
public EventDao getEventDao();
|
||||
public UserVmDao getVmDao();
|
||||
public AccountDao getAccountDao();
|
||||
public VolumeDao getVolumeDao();
|
||||
public DomainRouterDao getRouterDao();
|
||||
public IPAddressDao getIpAddressDao();
|
||||
public AsyncJobDao getJobDao();
|
||||
public UserDao getUserDao();
|
||||
public VirtualMachineManager getItMgr();
|
||||
}
|
||||
|
|
@ -1,146 +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;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.async.dao.AsyncJobDao;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.snapshot.SnapshotManager;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.vm.UserVmManager;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
@Component
|
||||
@Local(value={AsyncJobExecutorContext.class})
|
||||
public class AsyncJobExecutorContextImpl extends ManagerBase implements AsyncJobExecutorContext {
|
||||
|
||||
@Inject private AgentManager _agentMgr;
|
||||
@Inject private NetworkModel _networkMgr;
|
||||
@Inject private UserVmManager _vmMgr;
|
||||
@Inject private SnapshotManager _snapMgr;
|
||||
@Inject private AccountManager _accountMgr;
|
||||
@Inject private StorageManager _storageMgr;
|
||||
@Inject private EventDao _eventDao;
|
||||
@Inject private UserVmDao _vmDao;
|
||||
@Inject private AccountDao _accountDao;
|
||||
@Inject private VolumeDao _volumeDao;
|
||||
@Inject private DomainRouterDao _routerDao;
|
||||
@Inject private IPAddressDao _ipAddressDao;
|
||||
@Inject private AsyncJobDao _jobDao;
|
||||
@Inject private UserDao _userDao;
|
||||
@Inject private VirtualMachineManager _itMgr;
|
||||
|
||||
@Inject private ManagementServer _managementServer;
|
||||
|
||||
@Override
|
||||
public ManagementServer getManagementServer() {
|
||||
return _managementServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentManager getAgentMgr() {
|
||||
return _agentMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkModel getNetworkMgr() {
|
||||
return _networkMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVmManager getVmMgr() {
|
||||
return _vmMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageManager getStorageMgr() {
|
||||
return _storageMgr;
|
||||
}
|
||||
|
||||
/**server/src/com/cloud/async/AsyncJobExecutorContext.java
|
||||
* @return the _snapMgr
|
||||
*/
|
||||
@Override
|
||||
public SnapshotManager getSnapshotMgr() {
|
||||
return _snapMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountManager getAccountMgr() {
|
||||
return _accountMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventDao getEventDao() {
|
||||
return _eventDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVmDao getVmDao() {
|
||||
return _vmDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountDao getAccountDao() {
|
||||
return _accountDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolumeDao getVolumeDao() {
|
||||
return _volumeDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainRouterDao getRouterDao() {
|
||||
return _routerDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPAddressDao getIpAddressDao() {
|
||||
return _ipAddressDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJobDao getJobDao() {
|
||||
return _jobDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDao getUserDao() {
|
||||
return _userDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineManager getItMgr() {
|
||||
return _itMgr;
|
||||
}
|
||||
}
|
||||
|
|
@ -23,10 +23,8 @@ import com.cloud.utils.component.Manager;
|
|||
|
||||
public interface AsyncJobManager extends Manager {
|
||||
|
||||
public AsyncJobExecutorContext getExecutorContext();
|
||||
|
||||
public AsyncJobVO getAsyncJob(long jobId);
|
||||
public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId);
|
||||
public AsyncJobVO getAsyncJob(long jobId);
|
||||
public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId);
|
||||
|
||||
public List<? extends AsyncJob> findInstancePendingAsyncJobs(AsyncJob.Type instanceType, Long accountId);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,15 +86,15 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
|||
private static final int HEARTBEAT_INTERVAL = 2000;
|
||||
private static final int GC_INTERVAL = 10000; // 10 seconds
|
||||
|
||||
@Inject private AsyncJobExecutorContext _context;
|
||||
@Inject private SyncQueueManager _queueMgr;
|
||||
@Inject private ClusterManager _clusterMgr;
|
||||
@Inject private AccountManager _accountMgr;
|
||||
@Inject private AccountDao _accountDao;
|
||||
@Inject private AsyncJobDao _jobDao;
|
||||
@Inject private ConfigurationDao _configDao;
|
||||
|
||||
private long _jobExpireSeconds = 86400; // 1 day
|
||||
private long _jobCancelThresholdSeconds = 3600; // 1 hour (for cancelling the jobs blocking other jobs)
|
||||
private long _jobCancelThresholdSeconds = 3600; // 1 hour (for cancelling the jobs blocking other jobs)
|
||||
|
||||
@Inject private ApiDispatcher _dispatcher;
|
||||
|
||||
|
|
@ -102,11 +102,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
|||
Executors.newScheduledThreadPool(1, new NamedThreadFactory("AsyncJobMgr-Heartbeat"));
|
||||
private ExecutorService _executor;
|
||||
|
||||
@Override
|
||||
public AsyncJobExecutorContext getExecutorContext() {
|
||||
return _context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJobVO getAsyncJob(long jobId) {
|
||||
return _jobDao.findById(jobId);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@ package com.cloud.async;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
|
|||
Loading…
Reference in New Issue