cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ro...@apache.org
Subject [cloudstack] branch master updated: CLOUDSTACK-10363: refactor the "getXXX" and "listXXX" method names to "findXXX" (#2599)
Date Tue, 01 May 2018 15:14:52 GMT
This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c681b8  CLOUDSTACK-10363: refactor the "getXXX" and "listXXX" method names to "findXXX"
(#2599)
2c681b8 is described below

commit 2c681b8c5f253ae6e78314ac6f5bc3b1863bec4c
Author: Kui LIU <brucekuiliu@gmail.com>
AuthorDate: Tue May 1 17:14:43 2018 +0200

    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.
---
 .../cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java    |  4 ++--
 .../main/java/com/cloud/network/ovs/OvsTunnelManagerImpl.java  | 10 +++++-----
 .../java/com/cloud/network/ovs/dao/OvsTunnelNetworkDao.java    |  2 +-
 .../com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java     |  2 +-
 .../secondarystorage/PremiumSecondaryStorageManagerImpl.java   |  4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

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 3ce96a6..174f1f3 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 @@ 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 {
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 cde4ee8..aa7c0f6 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 @@ 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);
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 1c7f493..0aeb271 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 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);
 
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 5e314f0..6d12c19 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 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);
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 357c55e..ecfc67e 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 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);

-- 
To stop receiving notification emails like this one, please contact
rohit@apache.org.

Mime
View raw message