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)

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

void onError(java.lang.Exception error)

@deprecated since 0.6; use onException(Exception)

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(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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

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


logProblem

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


onError

@Override
public void onError(java.lang.Exception error)
deprecated:
since 0.6; use onException(Exception)


onException

logProblem("failure", exception);
public void onException(java.lang.Exception exception)


onFailure

logProblem("failure", val);
public void onFailure(java.lang.Object val)


onSuccess

} else {
public void onSuccess(java.lang.Object val)


toString

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

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.