brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/11] git commit: Use DependentConfiguration.builder().runNow()
Date Mon, 01 Sep 2014 16:55:36 GMT
Use DependentConfiguration.builder().runNow()

- also removes duplicate wait for attribute


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

Branch: refs/heads/master
Commit: bfc567d1e074987ccfea59f0ec35870cef39f41b
Parents: 109d711
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Aug 18 08:28:26 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Aug 18 08:30:34 2014 +0100

----------------------------------------------------------------------
 .../nosql/mongodb/MongoDBClientSshDriver.java    | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/bfc567d1/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBClientSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBClientSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBClientSshDriver.java
index 7e394f2..e31ecd1 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBClientSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBClientSshDriver.java
@@ -122,14 +122,11 @@ public class MongoDBClientSshDriver extends AbstractMongoDBSshDriver
implements
         AbstractMongoDBServer server = entity.getConfig(MongoDBClient.SERVER);
         MongoDBShardedDeployment deployment = entity.getConfig(MongoDBClient.SHARDED_DEPLOYMENT);
         if (server == null) {
-            Preconditions.checkNotNull(deployment, "Either server or shardedDeployment must
be specified");
-            Task<MongoDBRouter> task = DependentConfiguration.attributeWhenReady(deployment.getRouterCluster(),
-                    MongoDBRouterCluster.ANY_ROUTER);
-            try {
-                server = DependentConfiguration.waitForTask(task, entity, "any available
router");
-            } catch (InterruptedException e) {
-                throw Exceptions.propagate(e);
-            }
+            Preconditions.checkNotNull(deployment, "Either server or shardedDeployment must
be specified for %s", this);
+            server = DependentConfiguration.builder()
+                    .attributeWhenReady(deployment.getRouterCluster(), MongoDBRouterCluster.ANY_ROUTER)
+                    .blockingDetails("any available router")
+                    .runNow();
             DependentConfiguration.builder()
                     .attributeWhenReady(server, MongoDBRouter.SHARD_COUNT)
                     .readiness(MathPredicates.<Integer>greaterThan(0))
@@ -139,12 +136,6 @@ public class MongoDBClientSshDriver extends AbstractMongoDBSshDriver
implements
                 log.warn("Server and ShardedDeployment defined for {}; using server ({} instead
of {})", 
                         new Object[] {this, server, deployment});
             }
-            Task<Boolean> task = DependentConfiguration.attributeWhenReady(server,
Startable.SERVICE_UP);
-            try {
-                DependentConfiguration.waitForTask(task, server);
-            } catch (InterruptedException e) {
-                throw Exceptions.propagate(e);
-            }
             DependentConfiguration.builder()
                     .attributeWhenReady(server, Startable.SERVICE_UP)
                     .readiness(Predicates.equalTo(true))


Mime
View raw message