/** @see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener) */ public <T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener) { SubscriptionHandle handle = context.subscribe(producer, sensor, listener); synchronized (subscriptions) { subscriptions.put(producer, handle); } return handle; }
SubscriptionHandle subscription = null; try { subscription = ((EntityInternal)entity).getSubscriptionContext().subscribe(source, sensor, new SensorEventListener<T>() { @Override public void onEvent(SensorEvent<T> event) { data.set(event.getValue());