Brooklyn

brooklyn.event.feed.function
[Java] Class FunctionFeed

java.lang.Object
  brooklyn.event.feed.AbstractFeed
      brooklyn.event.feed.function.FunctionFeed

public class FunctionFeed
extends AbstractFeed

Provides a feed of attribute values, by periodically invoking functions. Example usage (e.g. in an entity that extends SoftwareProcessImpl):

 private FunctionFeed feed;
 
 //@Override
 protected void connectSensors() {
   super.connectSensors();
   
   feed = FunctionFeed.builder()
     .entity(this)
     .poll(new FunctionPollConfig(SERVICE_UP)
         .period(500, TimeUnit.MILLISECONDS)
         .callable(new Callable() {
             public Boolean call() throws Exception {
               return getDriver().isRunning();
             
         })
         .onError(Functions.constant(Boolan.FALSE))
     .build();
 }
 
 {
literal:
@}Override protected void disconnectSensors() { super.disconnectSensors(); if (feed != null) feed.stop(); } }
Authors:
aled


Nested Class Summary
static class FunctionFeed.Builder

 
Field Summary
static Logger log

 
Fields inherited from class AbstractFeed
entity, poller
 
Method Summary
protected java.lang.Object FunctionFeed(FunctionFeed.Builder builder)

static FunctionFeed.Builder builder()

protected void preStart()

 
Methods inherited from class AbstractFeed
getEntity, isActivated, isActive, isConnected, postStop, preStart, preStop, resume, start, stop, suspend
 

Field Detail

log

public static final Logger log


 
Method Detail

FunctionFeed

protected java.lang.Object FunctionFeed(FunctionFeed.Builder builder)


builder

public static FunctionFeed.Builder builder()


preStart

@Override
protected void preStart()


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.