Repository: cloudstack Updated Branches: refs/heads/4.3 ec4db7bbf -> f3668453f
Fix compile issues in mysql-ha plugin Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f3668453 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f3668453 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f3668453 Branch: refs/heads/4.3 Commit: f3668453f08d1289f2b360537c0e88a2661f3a9c Parents: ec4db7b Author: Hugo Trippaers <[email protected]> Authored: Wed Mar 12 09:03:58 2014 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Wed Mar 12 09:03:58 2014 +0100 ---------------------------------------------------------------------- plugins/database/mysql-ha/pom.xml | 4 ++-- .../src/com/cloud/utils/db/StaticStrategy.java | 21 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3668453/plugins/database/mysql-ha/pom.xml ---------------------------------------------------------------------- diff --git a/plugins/database/mysql-ha/pom.xml b/plugins/database/mysql-ha/pom.xml index 5ce6d6f..d5eb397 100644 --- a/plugins/database/mysql-ha/pom.xml +++ b/plugins/database/mysql-ha/pom.xml @@ -15,8 +15,8 @@ <parent> <groupId>org.apache.cloudstack</groupId> <artifactId>cloudstack-plugins</artifactId> - <version>4.4.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> + <version>4.3.0</version> + <relativePath>../../pom.xml</relativePath> </parent> <dependencies> <dependency> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3668453/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java ---------------------------------------------------------------------- diff --git a/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java b/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java index 29e96df..5426c5f 100644 --- a/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java +++ b/plugins/database/mysql-ha/src/com/cloud/utils/db/StaticStrategy.java @@ -34,14 +34,17 @@ public class StaticStrategy implements BalanceStrategy { public StaticStrategy() { } + @Override public void destroy() { // we don't have anything to clean up } + @Override public void init(Connection conn, Properties props) throws SQLException { // we don't have anything to initialize } + @Override public ConnectionImpl pickConnection(LoadBalancingConnectionProxy proxy, List<String> configuredHosts, Map<String, ConnectionImpl> liveConnections, long[] responseTimes, int numRetries) throws SQLException { @@ -51,13 +54,13 @@ public class StaticStrategy implements BalanceStrategy { List<String> whiteList = new ArrayList<String>(numHosts); whiteList.addAll(configuredHosts); - + Map<String, Long> blackList = proxy.getGlobalBlacklist(); whiteList.removeAll(blackList.keySet()); - - Map<String, Integer> whiteListMap = this.getArrayIndexMap(whiteList); - + + Map<String, Integer> whiteListMap = getArrayIndexMap(whiteList); + for (int attempts = 0; attempts < numRetries;) { if(whiteList.size() == 0){ @@ -81,7 +84,7 @@ public class StaticStrategy implements BalanceStrategy { // exclude this host from being picked again if (whiteListIndex != null) { whiteList.remove(whiteListIndex.intValue()); - whiteListMap = this.getArrayIndexMap(whiteList); + whiteListMap = getArrayIndexMap(whiteList); } proxy.addToGlobalBlacklist( hostPortSpec ); @@ -98,7 +101,7 @@ public class StaticStrategy implements BalanceStrategy { blackList = proxy.getGlobalBlacklist(); whiteList.removeAll(blackList.keySet()); - whiteListMap = this.getArrayIndexMap(whiteList); + whiteListMap = getArrayIndexMap(whiteList); } continue; @@ -107,7 +110,7 @@ public class StaticStrategy implements BalanceStrategy { throw sqlEx; } } - + return conn; } @@ -117,14 +120,14 @@ public class StaticStrategy implements BalanceStrategy { return null; // we won't get here, compiler can't tell } - + private Map<String, Integer> getArrayIndexMap(List<String> l) { Map<String, Integer> m = new HashMap<String, Integer>(l.size()); for (int i = 0; i < l.size(); i++) { m.put(l.get(i), Integer.valueOf(i)); } return m; - + } } \ No newline at end of file
