Brooklyn

brooklyn.event.feed
[Java] Class AttributePollHandler

java.lang.Object
  brooklyn.event.feed.AttributePollHandler
All Implemented Interfaces:
PollHandler

public class AttributePollHandler

Handler for when polling an entity's attribute. On each poll result the entity's attribute is set. Calls to onSuccess and onError will happen sequentially, but may be called from different threads each time. Note that no guarantees of a synchronized block exist, so additional synchronization would be required for the Java memory model's "happens before" relationship.

Authors:
aled


Field Summary
static Logger log

 
Constructor Summary
AttributePollHandler(FeedConfig config, EntityLocal entity, AbstractFeed feed)

 
Method Summary
boolean checkSuccess(java.lang.Object val)

java.lang.String getDescription()

protected void logProblem(java.lang.String type, java.lang.Object val)

void onException(java.lang.Exception exception)

void onFailure(java.lang.Object val)

void onSuccess(java.lang.Object val)

java.lang.String toString()

protected java.lang.Object transformError(java.lang.Exception error)

Does post-processing on a poll error, to convert it to the attribute's new value.

protected java.lang.Object transformValue(java.lang.Object val)

Does post-processing on the result of the actual poll, to convert it to the attribute's new value.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

log

public static final Logger log


 
Constructor Detail

AttributePollHandler

public AttributePollHandler(FeedConfig config, EntityLocal entity, AbstractFeed feed)


 
Method Detail

checkSuccess

@java.lang.Override}
public boolean checkSuccess(java.lang.Object val)


getDescription

@java.lang.Override
public java.lang.String getDescription()


logProblem

protected void logProblem(java.lang.String type, java.lang.Object val)


onException

@java.lang.SuppressWarnings} else {
@java.lang.OverridelogProblem("exception", exception);
public void onException(java.lang.Exception exception)


onFailure

@java.lang.SuppressWarnings} else {
@java.lang.OverridelogProblem("failure", val);
public void onFailure(java.lang.Object val)


onSuccess

@java.lang.SuppressWarningslog.info("Success (following previous problem) reading "+entity+"->"+sensor);
@java.lang.Override} else {
public void onSuccess(java.lang.Object val)


toString

@java.lang.Overridepublic String getDescription() {
public java.lang.String toString()


transformError

protected java.lang.Object transformError(java.lang.Exception error)
Does post-processing on a poll error, to convert it to the attribute's new value. Or returns PollConfig.UNSET if the post-processing indicates that the attribute should not be changed.


transformValue

@java.lang.SuppressWarnings}
protected java.lang.Object transformValue(java.lang.Object val)
Does post-processing on the result of the actual poll, to convert it to the attribute's new value. Or returns PollConfig.UNSET if the post-processing indicates that the attribute should not be changed.


 

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