public class LocalSubscriptionManager extends AbstractSubscriptionManager
SubscriptionManager
that stores subscription details locally.
Synchronization model: methods in this class synch on this object to ensure
subscription order and delivery order on publish.
Frequently it will be called by a thread holding a lock on a value
(eg AttributeMap
, this synchronized methods here should not
call to any value that may require that lock.
In particular notifications of initial value should not look up values.
AbstractSubscriptionManager.EntitySensorToken
Constructor and Description |
---|
LocalSubscriptionManager(ExecutionManager m) |
Modifier and Type | Method and Description |
---|---|
long |
getNumSubscriptions() |
java.util.Set<SubscriptionHandle> |
getSubscriptionsForEntitySensor(Entity source,
Sensor<?> sensor)
Return the subscriptions on a given source-sensor pair
|
java.util.Set<SubscriptionHandle> |
getSubscriptionsForSubscriber(java.lang.Object subscriber)
Return the subscriptions requested by a given subscriber
|
long |
getTotalEventsDelivered()
The total number of sensor change events submitted for delivery, counting multiple deliveries for multipe subscribers (see
getTotalEventsPublished() ),
but excluding initial notifications, and incremented when submitted ie prior to delivery |
long |
getTotalEventsPublished()
The total number of sensor change events generated (irrespective of number subscribers, see
getTotalEventsDelivered() ) |
<T> void |
publish(SensorEvent<T> event)
performs the actual publishing -- ie distribution to subscriptions
|
java.lang.String |
toString() |
boolean |
unsubscribe(SubscriptionHandle sh)
Unsubscribe the given subscription id.
|
subscribe, subscribe, subscribeToChildren, subscribeToChildren, subscribeToMembers, subscribeToMembers
public LocalSubscriptionManager(ExecutionManager m)
public long getNumSubscriptions()
public long getTotalEventsPublished()
getTotalEventsDelivered()
)public long getTotalEventsDelivered()
getTotalEventsPublished()
),
but excluding initial notifications, and incremented when submitted ie prior to deliverypublic java.util.Set<SubscriptionHandle> getSubscriptionsForSubscriber(java.lang.Object subscriber)
SubscriptionManager
public java.util.Set<SubscriptionHandle> getSubscriptionsForEntitySensor(Entity source, Sensor<?> sensor)
SubscriptionManager
public boolean unsubscribe(SubscriptionHandle sh)
AbstractSubscriptionManager.subscribe(Map, Entity, Sensor, SensorEventListener)
public <T> void publish(SensorEvent<T> event)
AbstractSubscriptionManager
publish
in interface SubscriptionManager
publish
in class AbstractSubscriptionManager
public java.lang.String toString()
toString
in class java.lang.Object