mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
CLOUDSTACK-10363: refactor the "getXXX" and "listXXX" method names to "findXXX" (#2599)
These three methods are not direct getter or list. They try to find the target objects with the related arguments. So that, renaming them as "findXXX" should be more intuitive.
This commit is contained in:
parent
93509a431c
commit
2c681b8c5f
@ -482,7 +482,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
||||
throw new CloudRuntimeException("Unable to find dispatcher name: " + dispatcherName);
|
||||
}
|
||||
|
||||
private AsyncJobDispatcher getWakeupDispatcher(AsyncJob job) {
|
||||
private AsyncJobDispatcher findWakeupDispatcher(AsyncJob job) {
|
||||
if (_jobDispatchers != null) {
|
||||
List<AsyncJobJoinMapVO> joinRecords = _joinMapDao.listJoinRecords(job.getId());
|
||||
if (joinRecords.size() > 0) {
|
||||
@ -567,7 +567,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
||||
}
|
||||
|
||||
if ((getAndResetPendingSignals(job) & AsyncJob.Constants.SIGNAL_MASK_WAKEUP) != 0) {
|
||||
AsyncJobDispatcher jobDispatcher = getWakeupDispatcher(job);
|
||||
AsyncJobDispatcher jobDispatcher = findWakeupDispatcher(job);
|
||||
if (jobDispatcher != null) {
|
||||
jobDispatcher.runJob(job);
|
||||
} else {
|
||||
|
||||
@ -212,7 +212,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
Long from = r.getFrom();
|
||||
Long to = r.getTo();
|
||||
long networkId = r.getNetworkId();
|
||||
OvsTunnelNetworkVO tunnel = _tunnelNetworkDao.getByFromToNetwork(from, to, networkId);
|
||||
OvsTunnelNetworkVO tunnel = _tunnelNetworkDao.findByFromToNetwork(from, to, networkId);
|
||||
if (tunnel == null) {
|
||||
throw new CloudRuntimeException(
|
||||
String.format("Unable find tunnelNetwork record" +
|
||||
@ -321,7 +321,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
if (rh == hostId) {
|
||||
continue;
|
||||
}
|
||||
OvsTunnelNetworkVO ta = _tunnelNetworkDao.getByFromToNetwork(hostId, rh.longValue(), nw.getId());
|
||||
OvsTunnelNetworkVO ta = _tunnelNetworkDao.findByFromToNetwork(hostId, rh.longValue(), nw.getId());
|
||||
// Try and create the tunnel even if a previous attempt failed
|
||||
if (ta == null || ta.getState().equals(OvsTunnel.State.Failed.name())) {
|
||||
s_logger.debug("Attempting to create tunnel from:" + hostId + " to:" + rh.longValue());
|
||||
@ -333,7 +333,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
}
|
||||
}
|
||||
|
||||
ta = _tunnelNetworkDao.getByFromToNetwork(rh.longValue(),
|
||||
ta = _tunnelNetworkDao.findByFromToNetwork(rh.longValue(),
|
||||
hostId, nw.getId());
|
||||
// Try and create the tunnel even if a previous attempt failed
|
||||
if (ta == null || ta.getState().equals(OvsTunnel.State.Failed.name())) {
|
||||
@ -605,7 +605,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
if (rh == hostId) {
|
||||
continue;
|
||||
}
|
||||
tunnelRecord = _tunnelNetworkDao.getByFromToNetwork(hostId, rh.longValue(), vpcNetwork.getId());
|
||||
tunnelRecord = _tunnelNetworkDao.findByFromToNetwork(hostId, rh.longValue(), vpcNetwork.getId());
|
||||
// Try and create the tunnel if does not exit or previous attempt failed
|
||||
if (tunnelRecord == null || tunnelRecord.getState().equals(OvsTunnel.State.Failed.name())) {
|
||||
s_logger.debug("Attempting to create tunnel from:" + hostId + " to:" + rh.longValue());
|
||||
@ -616,7 +616,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
toHostIds.add(rh);
|
||||
}
|
||||
}
|
||||
tunnelRecord = _tunnelNetworkDao.getByFromToNetwork(rh.longValue(), hostId, vpcNetwork.getId());
|
||||
tunnelRecord = _tunnelNetworkDao.findByFromToNetwork(rh.longValue(), hostId, vpcNetwork.getId());
|
||||
// Try and create the tunnel if does not exit or previous attempt failed
|
||||
if (tunnelRecord == null || tunnelRecord.getState().equals(OvsTunnel.State.Failed.name())) {
|
||||
s_logger.debug("Attempting to create tunnel from:" + rh.longValue() + " to:" + hostId);
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.List;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface OvsTunnelNetworkDao extends GenericDao<OvsTunnelNetworkVO, Long> {
|
||||
OvsTunnelNetworkVO getByFromToNetwork(long from, long to, long networkId);
|
||||
OvsTunnelNetworkVO findByFromToNetwork(long from, long to, long networkId);
|
||||
|
||||
void removeByFromNetwork(long from, long networkId);
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class OvsTunnelNetworkDaoImpl extends GenericDaoBase<OvsTunnelNetworkVO,
|
||||
}
|
||||
|
||||
@Override
|
||||
public OvsTunnelNetworkVO getByFromToNetwork(long from, long to, long networkId) {
|
||||
public OvsTunnelNetworkVO findByFromToNetwork(long from, long to, long networkId) {
|
||||
SearchCriteria<OvsTunnelNetworkVO> sc = fromToNetworkSearch.create();
|
||||
sc.setParameters("from", from);
|
||||
sc.setParameters("to", to);
|
||||
|
||||
@ -136,7 +136,7 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
|
||||
|
||||
alreadyRunning = _secStorageVmDao.getSecStorageVmListInStates(null, dataCenterId, State.Running, State.Migrating, State.Starting);
|
||||
|
||||
List<CommandExecLogVO> activeCmds = listActiveCommands(dataCenterId, cutTime);
|
||||
List<CommandExecLogVO> activeCmds = findActiveCommands(dataCenterId, cutTime);
|
||||
if (alreadyRunning.size() * _capacityPerSSVM - activeCmds.size() < _standbyCapacity) {
|
||||
s_logger.info("secondary storage command execution standby capactiy low (running VMs: " + alreadyRunning.size() + ", active cmds: " + activeCmds.size() +
|
||||
"), starting a new one");
|
||||
@ -163,7 +163,7 @@ public class PremiumSecondaryStorageManagerImpl extends SecondaryStorageManagerI
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<CommandExecLogVO> listActiveCommands(long dcId, Date cutTime) {
|
||||
private List<CommandExecLogVO> findActiveCommands(long dcId, Date cutTime) {
|
||||
SearchCriteria<CommandExecLogVO> sc = activeCommandSearch.create();
|
||||
|
||||
sc.setParameters("created", cutTime);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user