/** * Unsubscribes the given producer. * * @see SubscriptionContext#unsubscribe(SubscriptionHandle) */ protected boolean unsubscribe(Entity producer) { if (destroyed.get()) return false; return getSubscriptionTracker().unsubscribe(producer); }
/** * Unsubscribes the given producer. * * @see SubscriptionContext#unsubscribe(SubscriptionHandle) */ protected boolean unsubscribe(Entity producer, SubscriptionHandle handle) { if (destroyed.get()) return false; return getSubscriptionTracker().unsubscribe(producer, handle); }
/** * @return a list of all subscription handles */ protected Collection<SubscriptionHandle> getAllSubscriptions() { SubscriptionTracker tracker = getSubscriptionTracker(); return (tracker != null) ? tracker.getAllSubscriptions() : Collections.<SubscriptionHandle>emptyList(); }
/** * Unsubscribes and clears all managed subscriptions; is called by the owning entity when a policy is removed * and should always be called by any subclasses overriding this method */ public void destroy() { destroyed.set(true); SubscriptionTracker tracker = getSubscriptionTracker(); if (tracker != null) tracker.unsubscribeAll(); }
/** @see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener) */ protected <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) { if (!check(entity)) return null; return getSubscriptionTracker().subscribe(producer, sensor, listener); }
/** @see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener) */ protected <T> SubscriptionHandle subscribeToChildren(Entity producerParent, Sensor<T> sensor, SensorEventListener<? super T> listener) { if (!check(producerParent)) return null; return getSubscriptionTracker().subscribeToChildren(producerParent, sensor, listener); }
/** @see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener) */ protected <T> SubscriptionHandle subscribeToMembers(Group producerGroup, Sensor<T> sensor, SensorEventListener<? super T> listener) { if (!check(producerGroup)) return null; return getSubscriptionTracker().subscribeToMembers(producerGroup, sensor, listener); }