public synchronized void add ( final ItemUpdateListener listener ) { if ( !this.listeners.containsKey ( listener ) ) { this.listeners.put ( listener, new ListenerInfo ( listener ) ); final SubscriptionState state = this.subscriptionState; final Throwable error = this.subscriptionError; final Variant value = this.cachedValue; final Map<String, Variant> attributes = new HashMap<String, Variant> ( this.cachedAttributes ); logger.trace ( "Sending out cache values - itemId: {}, state: {}, value: {}, attributes: {}", new Object[] { this.itemId, state, value, attributes } ); // send the initial update this.itemManager.getExecutor ().execute ( new Runnable () { @Override public void run () { listener.notifySubscriptionChange ( state, error ); listener.notifyDataChange ( value, attributes, true ); } } ); sync ( false ); } }
public synchronized void add ( final ItemUpdateListener listener ) { if ( !this.listeners.containsKey ( listener ) ) { this.listeners.put ( listener, new ListenerInfo ( listener ) ); final SubscriptionState state = this.subscriptionState; final Throwable error = this.subscriptionError; final Variant value = this.cachedValue; final Map<String, Variant> attributes = new HashMap<String, Variant> ( this.cachedAttributes ); logger.trace ( "Sending out cache values - itemId: {}, state: {}, value: {}, attributes: {}", new Object[] { this.itemId, state, value, attributes } ); // send the initial update this.itemManager.getExecutor ().execute ( new Runnable () { @Override public void run () { listener.notifySubscriptionChange ( state, error ); listener.notifyDataChange ( value, attributes, true ); } } ); sync ( false ); } }
@Override public void run () { for ( final ListenerInfo listenerInfo : listeners ) { try { listenerInfo.getListener ().notifySubscriptionChange ( subscriptionState, e ); } catch ( final Exception e ) { logger.info ( "Failed to notify listener subscription change", e ); } } } } );
@Override public void run () { for ( final ListenerInfo listenerInfo : listeners ) { try { listenerInfo.getListener ().notifySubscriptionChange ( subscriptionState, e ); } catch ( final Exception e ) { logger.info ( "Failed to notify listener subscription change", e ); } } } } );
@Override public void run () { for ( final ListenerInfo listenerInfo : listeners ) { try { listenerInfo.getListener ().notifyDataChange ( value, attributes, cache ); } catch ( final Exception e ) { logger.info ( "Failed to notify listener for data change", e ); } } } } );
@Override public void run () { for ( final ListenerInfo listenerInfo : listeners ) { try { listenerInfo.getListener ().notifyDataChange ( value, attributes, cache ); } catch ( final Exception e ) { logger.info ( "Failed to notify listener for data change", e ); } } } } );