Brooklyn

brooklyn.management.internal
[Java] Class LocalSubscriptionManager

java.lang.Object
  brooklyn.management.internal.LocalSubscriptionManager
All Implemented Interfaces:
SubscriptionManager

public class LocalSubscriptionManager

A SubscriptionManager that stores subscription details locally.


Nested Class Summary
static class LocalSubscriptionManager.EntitySensorToken

 
Field Summary
protected java.util.concurrent.ConcurrentMap allSubscriptions

protected ExecutionManager em

protected java.util.concurrent.ConcurrentMap subscriptionsBySubscriber

protected java.util.concurrent.ConcurrentMap subscriptionsByToken

 
Method Summary
java.lang.Object LocalSubscriptionManager(ExecutionManager m)

long getNumSubscriptions()

java.util.Set getSubscriptionsForEntitySensor(Entity source, Sensor sensor)

java.util.Set getSubscriptionsForSubscriber(java.lang.Object subscriber)

long getTotalEventsDelivered()

long getTotalEventsPublished()

void publish(SensorEvent event)

SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribe(java.util.Map flags, Entity producer, Sensor sensor, SensorEventListener listener)

This implementation handles the following flags, in addition to those described in the SubscriptionManager interface:

  • subscriberExecutionManagerTag - a tag to pass to execution manager (without setting any execution semantics / TaskPreprocessor); if not supplied and there is a subscriber, this will be inferred from the subscriber and set up with SingleThreadedScheduler (supply this flag with value null to prevent any task preprocessor from being set)
  • eventFilter - a Predicate<SensorEvent> instance to filter what events are delivered

SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribeToChildren(java.util.Map flags, Entity parent, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribeToMembers(Group parent, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribeToMembers(java.util.Map flags, Group parent, Sensor sensor, SensorEventListener listener)

@see SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)

java.lang.String toString()

boolean unsubscribe(SubscriptionHandle sh)

Unsubscribe the given subscription id.

 
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

allSubscriptions

protected final java.util.concurrent.ConcurrentMap allSubscriptions


em

protected final ExecutionManager em


subscriptionsBySubscriber

protected final java.util.concurrent.ConcurrentMap subscriptionsBySubscriber


subscriptionsByToken

protected final java.util.concurrent.ConcurrentMap subscriptionsByToken


 
Method Detail

LocalSubscriptionManager

public java.lang.Object LocalSubscriptionManager(ExecutionManager m)


getNumSubscriptions

public long getNumSubscriptions()


getSubscriptionsForEntitySensor

public java.util.Set getSubscriptionsForEntitySensor(Entity source, Sensor sensor)


getSubscriptionsForSubscriber

@SuppressWarnings("unchecked")
public java.util.Set getSubscriptionsForSubscriber(java.lang.Object subscriber)


getTotalEventsDelivered

public long getTotalEventsDelivered()


getTotalEventsPublished

public long getTotalEventsPublished()


publish

public void publish(SensorEvent event)


subscribe

public SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)#subscribe(Map, Entity, Sensor, SensorEventListener)


subscribe

public SubscriptionHandle subscribe(java.util.Map flags, Entity producer, Sensor sensor, SensorEventListener listener)
This implementation handles the following flags, in addition to those described in the SubscriptionManager interface:
See Also:
SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)#subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToChildren

public SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)


subscribeToChildren

public SubscriptionHandle subscribeToChildren(java.util.Map flags, Entity parent, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)#subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToMembers

public SubscriptionHandle subscribeToMembers(Group parent, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)#subscribeToChildren(Map, Entity, Sensor, SensorEventListener)


subscribeToMembers

public SubscriptionHandle subscribeToMembers(java.util.Map flags, Group parent, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionManager#subscribe(Map, Entity, Sensor, SensorEventListener)#subscribe(Map, Entity, Sensor, SensorEventListener)


toString

@Override
public java.lang.String toString()


unsubscribe

public boolean unsubscribe(SubscriptionHandle sh)
Unsubscribe the given subscription id.
See Also:
subscribe(Map, Entity, Sensor, SensorEventListener)


 

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