You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/10/08 01:59:53 UTC
[14/18] git commit: tidy following code review
tidy following code review
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/14d5c4ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/14d5c4ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/14d5c4ba
Branch: refs/heads/master
Commit: 14d5c4baeb1189048b782e04900a2e7753041ba6
Parents: ece1988
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Oct 7 02:10:15 2014 -0700
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Oct 7 02:10:32 2014 -0700
----------------------------------------------------------------------
.../entity/nosql/couchbase/CouchbaseClusterImpl.java | 12 ++++++------
.../entity/nosql/couchbase/CouchbaseNodeSshDriver.java | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/14d5c4ba/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
index 65fe9c9..82f27d7 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
@@ -420,16 +420,16 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
}
/** try adding in a loop because we are seeing spurious port failures in AWS */
- protected void addServerSeveralTimes(Entity s, int numAttempts, Duration delayOnFailure) {
+ protected void addServerSeveralTimes(Entity s, int numRetries, Duration delayOnFailure) {
try {
addServer(s);
} catch (Exception e) {
Exceptions.propagateIfFatal(e);
- if (numAttempts<=0) throw Exceptions.propagate(e);
+ if (numRetries<=0) throw Exceptions.propagate(e);
// retry once after sleep because we are getting some odd primary-change events
- log.warn("Error adding "+s+" to "+this+", "+numAttempts+" more attempts; will retry after delay ("+e+")");
+ log.warn("Error adding "+s+" to "+this+", "+numRetries+" retries remaining, will retry after delay ("+e+")");
Time.sleep(delayOnFailure);
- addServerSeveralTimes(s, numAttempts-1, delayOnFailure);
+ addServerSeveralTimes(s, numRetries-1, delayOnFailure);
}
}
@@ -459,11 +459,11 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
public static String getClusterName(Entity node) {
String name = node.getConfig(CLUSTER_NAME);
if (!Strings.isBlank(name)) return Strings.makeValidFilename(name);
- return getCluster(node).getId();
+ return getClusterOrNode(node).getId();
}
/** returns Couchbase cluster in ancestry, defaulting to the given node if none */
- @Nonnull public static Entity getCluster(Entity node) {
+ @Nonnull public static Entity getClusterOrNode(Entity node) {
Iterable<CouchbaseCluster> clusterNodes = Iterables.filter(Entities.ancestors(node), CouchbaseCluster.class);
return Iterables.getFirst(clusterNodes, node);
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/14d5c4ba/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
index 9d1fef4..ceea4a1 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
@@ -384,7 +384,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver imp
@Override
public void bucketCreate(String bucketName, String bucketType, Integer bucketPort, Integer bucketRamSize, Integer bucketReplica) {
- log.info("Adding bucket: {} to cluster {} primary node: {}", new Object[] { bucketName, CouchbaseClusterImpl.getCluster(getEntity()), getEntity() });
+ log.info("Adding bucket: {} to cluster {} primary node: {}", new Object[] { bucketName, CouchbaseClusterImpl.getClusterOrNode(getEntity()), getEntity() });
newScript("bucketCreate").body.append(couchbaseCli("bucket-create")
+ getCouchbaseHostnameAndCredentials() +