[ https://issues.apache.org/jira/browse/CLOUDSTACK-10363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16459746#comment-16459746 ]
ASF GitHub Bot commented on CLOUDSTACK-10363: --------------------------------------------- rhtyd closed pull request #2599: CLOUDSTACK-10363: Change method names. URL: https://github.com/apache/cloudstack/pull/2599 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java index 3ce96a677fb..174f1f300cf 100644 --- a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java +++ b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java @@ -482,7 +482,7 @@ private AsyncJobDispatcher getDispatcher(String dispatcherName) { 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 @@ protected void runInContext() { } if ((getAndResetPendingSignals(job) & AsyncJob.Constants.SIGNAL_MASK_WAKEUP) != 0) { - AsyncJobDispatcher jobDispatcher = getWakeupDispatcher(job); + AsyncJobDispatcher jobDispatcher = findWakeupDispatcher(job); if (jobDispatcher != null) { jobDispatcher.runJob(job); } else { diff --git a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/OvsTunnelManagerImpl.java index cde4ee8a797..aa7c0f6d1b2 100644 --- a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/OvsTunnelManagerImpl.java +++ b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/OvsTunnelManagerImpl.java @@ -212,7 +212,7 @@ private void handleCreateTunnelAnswer(Answer[] answers) { 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 @@ protected void checkAndCreateTunnel(Network nw, Host host) { 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 @@ protected void checkAndCreateTunnel(Network nw, Host host) { } } - 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 @@ protected void checkAndCreateVpcTunnelNetworks(Host host, long vpcId) { 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 @@ protected void checkAndCreateVpcTunnelNetworks(Host host, long vpcId) { 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); diff --git a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDao.java b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDao.java index 1c7f4934d0e..0aeb271c423 100644 --- a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDao.java +++ b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDao.java @@ -22,7 +22,7 @@ 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); diff --git a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java index 5e314f0fd69..6d12c1938d0 100644 --- a/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java +++ b/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java @@ -53,7 +53,7 @@ public OvsTunnelNetworkDaoImpl() { } @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); diff --git a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java index 357c55e5bf1..ecfc67eaff6 100644 --- a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java @@ -136,7 +136,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu 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 boolean configure(String name, Map<String, Object> params) throws Configu 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); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Inconsistent "getXXX" and "listXXX" method names. > ------------------------------------------------- > > Key: CLOUDSTACK-10363 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10363 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: KuiLIU > Priority: Major > > The following 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. > {code:java} > //cloudstack/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java > @Override > public OvsTunnelInterfaceVO getByHostAndLabel(long hostId, String label) { > SearchCriteria<OvsTunnelInterfaceVO> sc = hostAndLabelSearch.create(); > sc.setParameters("host_id", hostId); > sc.setParameters("label", label); > return findOneBy(sc); > } > //cloudstack/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java > private List<CommandExecLogVO> listActiveCommands(long dcId, Date > cutTime) { > SearchCriteria<CommandExecLogVO> sc = activeCommandSearch.create(); > sc.setParameters("created", cutTime); > sc.setJoinParameters("hostSearch", "dc", dcId); > sc.setJoinParameters("hostSearch", "status", Status.Up); > return _cmdExecLogDao.search(sc, null); > } > //cloudstack/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java > private AsyncJobDispatcher getWakeupDispatcher(AsyncJob job) { > if (_jobDispatchers != null) { > List<AsyncJobJoinMapVO> joinRecords = > _joinMapDao.listJoinRecords(job.getId()); > if (joinRecords.size() > 0) { > AsyncJobJoinMapVO joinRecord = joinRecords.get(0); > for (AsyncJobDispatcher dispatcher : _jobDispatchers) { > if > (dispatcher.getName().equals(joinRecord.getWakeupDispatcher())) > return dispatcher; > } > } else { > s_logger.warn("job-" + job.getId() + " is scheduled for > wakeup run, but there is no joining info anymore"); > } > } > return null; > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)