Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 72850105E3 for ; Tue, 18 Jun 2013 03:06:45 +0000 (UTC) Received: (qmail 43014 invoked by uid 500); 18 Jun 2013 03:06:34 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 42802 invoked by uid 500); 18 Jun 2013 03:06:33 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 41129 invoked by uid 99); 18 Jun 2013 03:06:30 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jun 2013 03:06:30 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 256C48A6A8B; Tue, 18 Jun 2013 03:06:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ahuang@apache.org To: commits@cloudstack.apache.org Date: Tue, 18 Jun 2013 03:06:58 -0000 Message-Id: <34c2554203a141deae0462e37073f99f@git.apache.org> In-Reply-To: <13f1695d503e4fbfa48b3b66ba92e6b8@git.apache.org> References: <13f1695d503e4fbfa48b3b66ba92e6b8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [33/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1 Removed String instantiation String instantiation and redundant method call replaced with a constant. Signed-off-by: Laszlo Hornyak 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 Authored: Sat Jun 8 21:46:40 2013 +0200 Committer: Chip Childers 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 result = new ArrayList(); 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> e : pools.entrySet()) { List 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 result = new ArrayList(); 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