Make SoftwareProcess.connectServiceUpIsRunning period configurable

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

Branch: refs/heads/master
Commit: 38fff659f6b8d7068ab0722c60a6ed9be1a14d1a
Parents: 9e320b1b
Author: Aled Sage <aled.s...@gmail.com>
Authored: Thu Aug 11 15:03:05 2016 +0100
Committer: Aled Sage <aled.s...@gmail.com>
Committed: Thu Aug 11 15:08:20 2016 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/entity/software/base/SoftwareProcess.java  | 6 ++++++
 .../brooklyn/entity/software/base/SoftwareProcessImpl.java     | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/38fff659/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java
----------------------------------------------------------------------
diff --git 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java
 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java
index 68a95ca..133ced5 100644
--- 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java
+++ 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java
@@ -260,6 +260,12 @@ public interface SoftwareProcess extends Entity, Startable 
{
                     "several others. Set to null or to 0 to disable any 
delay.",
             Duration.TEN_SECONDS);
 
+    ConfigKey<Duration> SERVICE_PROCESS_IS_RUNNING_POLL_PERIOD = 
ConfigKeys.newConfigKey(Duration.class,
+            "softwareProcess.serviceProcessIsRunningPollPeriod",
+            "The period for polling for whether the process is running; 
applies only if the entity "
+                    + "wires up the connectServiceUpIsRunning.",
+            Duration.FIVE_SECONDS);
+    
     /**
      * Sets the object that manages the sequence of calls of the entity's 
driver.
      */

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/38fff659/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java
 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java
index bb5f17a..5abc8e9 100644
--- 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java
+++ 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java
@@ -293,9 +293,10 @@ public abstract class SoftwareProcessImpl extends 
AbstractEntity implements Soft
      * @see #disconnectServiceUpIsRunning()
      */
     protected void connectServiceUpIsRunning() {
+        Duration period = config().get(SERVICE_PROCESS_IS_RUNNING_POLL_PERIOD);
         serviceProcessIsRunning = FunctionFeed.builder()
                 .entity(this)
-                .period(Duration.FIVE_SECONDS)
+                .period(period)
                 .poll(new FunctionPollConfig<Boolean, 
Boolean>(SERVICE_PROCESS_IS_RUNNING)
                         .suppressDuplicates(true)
                         .onException(Functions.constant(Boolean.FALSE))

Reply via email to