brooklyn.event.feed.AbstractFeed Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-core Show documentation
Show all versions of brooklyn-core Show documentation
Entity implementation classes, events, and other core elements
package brooklyn.event.feed;
import static com.google.common.base.Preconditions.checkNotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import brooklyn.entity.basic.EntityLocal;
/**
* Captures common fields and processes for sensor feeds.
* These generally poll or subscribe to get sensor values for an entity.
* They make it easy to poll over http, jmx, etc.
*
* Assumes:
*
* - There will not be concurrent calls to start and stop.
*
- There will only be one call to start and that will be done immediately after construction,
* in the same thread.
*
- Once stopped, the feed will not be re-started.
*
*/
public abstract class AbstractFeed {
private static final Logger log = LoggerFactory.getLogger(AbstractFeed.class);
protected final EntityLocal entity;
protected final Poller> poller;
private volatile Long lastConnectionTime;
private volatile boolean activated, suspended;
private final Object pollerStateMutex = new Object();
public AbstractFeed(EntityLocal entity) {
this.entity = checkNotNull(entity, "entity");
this.poller = new Poller
© 2015 - 2025 Weber Informatics LLC | Privacy Policy