cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [33/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1
Date Tue, 18 Jun 2013 03:06:58 GMT
Removed String instantiation

String instantiation and redundant method call replaced with a constant.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ce8ada03
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ce8ada03
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ce8ada03

Branch: refs/heads/vmsync
Commit: ce8ada030d3150087357d7135c3877c25a4702c2
Parents: a2c7d3a
Author: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Authored: Sat Jun 8 21:46:40 2013 +0200
Committer: Chip Childers <chip.childers@gmail.com>
Committed: Mon Jun 17 19:15:37 2013 +0100

----------------------------------------------------------------------
 .../com/cloud/network/HAProxyConfigurator.java  | 22 ++++++++------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce8ada03/core/src/com/cloud/network/HAProxyConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/HAProxyConfigurator.java b/core/src/com/cloud/network/HAProxyConfigurator.java
index 29fdf4a..162571f 100644
--- a/core/src/com/cloud/network/HAProxyConfigurator.java
+++ b/core/src/com/cloud/network/HAProxyConfigurator.java
@@ -33,7 +33,6 @@ import com.cloud.agent.api.to.LoadBalancerTO;
 import com.cloud.agent.api.to.PortForwardingRuleTO;
 import com.cloud.agent.api.to.LoadBalancerTO.DestinationTO;
 import com.cloud.agent.api.to.LoadBalancerTO.StickinessPolicyTO;
-import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
 import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
 import com.cloud.utils.net.NetUtils;
 
@@ -41,6 +40,7 @@ import com.cloud.utils.net.NetUtils;
 public class HAProxyConfigurator implements LoadBalancerConfigurator {
 
     private static final Logger s_logger = Logger.getLogger(HAProxyConfigurator.class);
+    private static final String blankLine = "\t ";
     private static String[] globalSection = { "global",
             "\tlog 127.0.0.1:3914   local0 warning", 
             "\tmaxconn 4096",
@@ -86,9 +86,9 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
         List<String> result = new ArrayList<String>();
 
         result.addAll(Arrays.asList(globalSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
         result.addAll(Arrays.asList(defaultsSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
 
         if (pools.isEmpty()) {
             // haproxy cannot handle empty listen / frontend or backend, so add
@@ -96,7 +96,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             // on port 9
             result.addAll(Arrays.asList(defaultListen));
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
 
         for (Map.Entry<String, List<PortForwardingRuleTO>> e : pools.entrySet())
{
             List<String> poolRules = getRulesForPool(e.getKey(), e.getValue());
@@ -143,7 +143,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
                     .append(rule.getDstPortRange()[0]).append(" check");
             result.add(sb.toString());
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         return result;
     }
  
@@ -507,14 +507,10 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator
{
             result.add(sb.toString());
         }
         
-        result.add(getBlankLine());
+        result.add(blankLine);
         return result;
     }
 
-    private String getBlankLine() {
-        return new String("\t ");
-    }
-
     private String generateStatsRule(LoadBalancerConfigCommand lbCmd,
             String ruleName, String statsIp) {
         StringBuilder rule = new StringBuilder("\nlisten ").append(ruleName)
@@ -534,7 +530,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
         List<String> result = new ArrayList<String>();
 
         result.addAll(Arrays.asList(globalSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
         result.addAll(Arrays.asList(defaultsSection));
         if (!lbCmd.lbStatsVisibility.equals("disabled")) {
             /* new rule : listen admin_page guestip/link-local:8081 */
@@ -568,7 +564,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             }
 
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         boolean has_listener = false;
         for (LoadBalancerTO lbTO : lbCmd.getLoadBalancers()) {
             if ( lbTO.isRevoked() ) {
@@ -578,7 +574,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             result.addAll(poolRules);
             has_listener = true;
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         if ( !has_listener) {
             // haproxy cannot handle empty listen / frontend or backend, so add
             // a dummy listener


Mime
View raw message