brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [03/18] incubator-brooklyn git commit: Entities suppress duplicates in feeds
Date Tue, 11 Aug 2015 20:42:41 GMT
Entities suppress duplicates in feeds


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

Branch: refs/heads/master
Commit: 81650a801f489db7d01a3f505a537363aa57a49f
Parents: 7f046a1
Author: Aled Sage <aled.sage@gmail.com>
Authored: Sat Apr 18 13:01:36 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Aug 11 17:51:23 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/entity/basic/SoftwareProcessImpl.java   |  1 +
 .../entity/database/mysql/MySqlNodeImpl.java         |  3 ++-
 .../messaging/activemq/ActiveMQBrokerImpl.java       |  3 ++-
 .../entity/nosql/cassandra/CassandraNodeImpl.java    | 15 ++++++++++-----
 .../entity/nosql/mongodb/MongoDBServerImpl.java      |  3 ++-
 .../entity/proxy/nginx/NginxControllerImpl.java      |  3 ++-
 .../entity/webapp/jboss/JBoss6ServerImpl.java        |  3 ++-
 .../entity/webapp/jboss/JBoss7ServerImpl.java        |  7 +++++--
 .../entity/webapp/tomcat/TomcatServerImpl.java       |  3 ++-
 9 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
index 79275b2..3ae2c9e 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
@@ -214,6 +214,7 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements
Soft
                 .entity(this)
                 .period(Duration.FIVE_SECONDS)
                 .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_PROCESS_IS_RUNNING)
+                        .suppressDuplicates(true)
                         .onException(Functions.constant(Boolean.FALSE))
                         .callable(new Callable<Boolean>() {
                             public Boolean call() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNodeImpl.java
b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNodeImpl.java
index 2e05fb0..8346fbb 100644
--- a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNodeImpl.java
+++ b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNodeImpl.java
@@ -112,7 +112,8 @@ public class MySqlNodeImpl extends SoftwareProcessImpl implements MySqlNode
{
                     .poll(new SshPollConfig<Boolean>(SERVICE_PROCESS_IS_RUNNING)
                             .command(cmd)
                             .setOnSuccess(true)
-                            .setOnFailureOrException(false))
+                            .setOnFailureOrException(false)
+                            .suppressDuplicates(true))
                     .build();
         } else {
             LOG.warn("Location(s) {} not an ssh-machine location, so not polling for status;
setting serviceUp immediately", getLocations());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java
b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java
index 19fae9d..83d8b6e 100644
--- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java
+++ b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java
@@ -101,7 +101,8 @@ public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue,
ActiveMQTop
                         .objectName(brokerMbeanName)
                         .attributeName("BrokerName")
                         .onSuccess(Functions.forPredicate(Predicates.notNull()))
-                        .onFailureOrException(Functions.constant(false)))
+                        .onFailureOrException(Functions.constant(false))
+                        .suppressDuplicates(true))
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
index 6d16c9a..c9923ef 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
@@ -414,7 +414,8 @@ public class CassandraNodeImpl extends SoftwareProcessImpl implements
CassandraN
                         .objectName(storageServiceMBean)
                         .attributeName("Initialized")
                         .onSuccess(Functions.forPredicate(Predicates.notNull()))
-                        .onException(Functions.constant(false)))
+                        .onException(Functions.constant(false))
+                        .suppressDuplicates(true))
                 .pollAttribute(new JmxAttributePollConfig<Set<BigInteger>>(TOKENS)
                         .objectName(storageServiceMBean)
                         .attributeName("TokenToEndpointMap")
@@ -432,7 +433,8 @@ public class CassandraNodeImpl extends SoftwareProcessImpl implements
CassandraN
                                 }
                                 return result;
                             }})
-                        .onException(Functions.<Set<BigInteger>>constant(null)))
+                        .onException(Functions.<Set<BigInteger>>constant(null))
+                        .suppressDuplicates(true))
                 .pollAttribute(new JmxAttributePollConfig<BigInteger>(TOKEN)
                         .objectName(storageServiceMBean)
                         .attributeName("TokenToEndpointMap")
@@ -448,19 +450,22 @@ public class CassandraNodeImpl extends SoftwareProcessImpl implements
CassandraN
                                 String token = Iterables.getFirst(tokens, null);
                                 return (token != null) ? new BigInteger(token) : null;
                             }})
-                        .onException(Functions.<BigInteger>constant(null)))
+                        .onException(Functions.<BigInteger>constant(null))
+                        .suppressDuplicates(true))
                 .pollOperation(new JmxOperationPollConfig<String>(DATACENTER_NAME)
                         .period(60, TimeUnit.SECONDS)
                         .objectName(snitchMBean)
                         .operationName("getDatacenter")
                         .operationParams(ImmutableList.of(getBroadcastAddress()))
-                        .onException(Functions.<String>constant(null)))
+                        .onException(Functions.<String>constant(null))
+                        .suppressDuplicates(true))
                 .pollOperation(new JmxOperationPollConfig<String>(RACK_NAME)
                         .period(60, TimeUnit.SECONDS)
                         .objectName(snitchMBean)
                         .operationName("getRack")
                         .operationParams(ImmutableList.of(getBroadcastAddress()))
-                        .onException(Functions.<String>constant(null)))
+                        .onException(Functions.<String>constant(null))
+                        .suppressDuplicates(true))
                 .pollAttribute(new JmxAttributePollConfig<Integer>(PEERS)
                         .objectName(storageServiceMBean)
                         .attributeName("TokenToEndpointMap")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
index 346b1ee..83c9cd1 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
@@ -114,7 +114,8 @@ public class MongoDBServerImpl extends SoftwareProcessImpl implements
MongoDBSer
                                     return ReplicaSetMemberStatus.fromCode(state);
                                 }
                             })
-                            .onException(Functions.constant(ReplicaSetMemberStatus.UNKNOWN)))
+                            .onException(Functions.constant(ReplicaSetMemberStatus.UNKNOWN))
+                            .suppressDuplicates(true))
                     .build();
         } else {
             setAttribute(IS_PRIMARY_FOR_REPLICA_SET, false);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/webapp/src/main/java/brooklyn/entity/proxy/nginx/NginxControllerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/proxy/nginx/NginxControllerImpl.java
b/software/webapp/src/main/java/brooklyn/entity/proxy/nginx/NginxControllerImpl.java
index 0253f96..f03e0d8 100644
--- a/software/webapp/src/main/java/brooklyn/entity/proxy/nginx/NginxControllerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/proxy/nginx/NginxControllerImpl.java
@@ -121,7 +121,8 @@ public class NginxControllerImpl extends AbstractControllerImpl implements
Nginx
                         // Accept any nginx response (don't assert specific version), so
that sub-classing
                         // for a custom nginx build is not strict about custom version numbers
in headers
                         .onResult(HttpValueFunctions.containsHeader("Server"))
-                        .setOnException(false))
+                        .setOnException(false)
+                        .suppressDuplicates(true))
                 .build());
         
         // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in persisted
state

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss6ServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss6ServerImpl.java
b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss6ServerImpl.java
index 2ce83a3..932fd44 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss6ServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss6ServerImpl.java
@@ -76,7 +76,8 @@ public class JBoss6ServerImpl extends JavaWebAppSoftwareProcessImpl implements
J
                 .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP)
                         .objectName(serverMbeanName)
                         .attributeName("Started")
-                        .onException(Functions.constant(false)))
+                        .onException(Functions.constant(false))
+                        .suppressDuplicates(true))
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
index 67fe955..258b6be 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
@@ -89,10 +89,12 @@ public class JBoss7ServerImpl extends JavaWebAppSoftwareProcessImpl implements
J
                 .baseUri(managementUri)
                 .credentials(getConfig(MANAGEMENT_USER), getConfig(MANAGEMENT_PASSWORD))
                 .poll(new HttpPollConfig<Integer>(MANAGEMENT_STATUS)
-                        .onSuccess(HttpValueFunctions.responseCode()))
+                        .onSuccess(HttpValueFunctions.responseCode())
+                        .suppressDuplicates(true))
                 .poll(new HttpPollConfig<Boolean>(MANAGEMENT_URL_UP)
                         .onSuccess(HttpValueFunctions.responseCodeEquals(200))
-                        .onFailureOrException(Functions.constant(false)))
+                        .onFailureOrException(Functions.constant(false))
+                        .suppressDuplicates(true))
                 .poll(new HttpPollConfig<Integer>(REQUEST_COUNT)
                         .vars(includeRuntimeUriVars)
                         .onSuccess(HttpValueFunctions.jsonContents("requestCount", Integer.class)))
@@ -123,6 +125,7 @@ public class JBoss7ServerImpl extends JavaWebAppSoftwareProcessImpl implements
J
         addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
             .from(MANAGEMENT_URL_UP)
             .computing(Functionals.ifNotEquals(true).value("Management URL not reachable")
)
+            .suppressDuplicates(true)
             .build());
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/81650a80/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
index 2618c31..929d120 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
@@ -76,7 +76,8 @@ public class TomcatServerImpl extends JavaWebAppSoftwareProcessImpl implements
T
                             .objectName(connectorMbeanName)
                             .attributeName("stateName")
                             .onSuccess(Functions.forPredicate(Predicates.<Object>equalTo("STARTED")))
-                            .setOnFailureOrException(false))
+                            .setOnFailureOrException(false)
+                            .suppressDuplicates(true))
                     .build();
 
             jmxAppFeed = JavaAppUtils.connectMXBeanSensors(this);


Mime
View raw message