protected void handlePerformNotifySubscriptionChange ( final SubscriptionState subscriptionState, final Throwable subscriptionError ) { final DataItemValue.Builder newValue = new DataItemValue.Builder ( this.value ); newValue.setSubscriptionState ( subscriptionState ); newValue.setSubscriptionError ( subscriptionError ); final DataItemValue oldValue = this.value; this.value = newValue.build (); setChanged (); try { notifyObservers ( this.value ); this.propertySupport.firePropertyChange ( PROP_VALUE, oldValue, this.value ); } catch ( final Throwable e ) { logger.warn ( "Failed to notify subscription change", e ); } }
protected void handlePerformNotifySubscriptionChange ( final SubscriptionState subscriptionState, final Throwable subscriptionError ) { final DataItemValue.Builder newValue = new DataItemValue.Builder ( this.value ); newValue.setSubscriptionState ( subscriptionState ); newValue.setSubscriptionError ( subscriptionError ); final DataItemValue oldValue = this.value; this.value = newValue.build (); setChanged (); try { notifyObservers ( this.value ); this.propertySupport.firePropertyChange ( PROP_VALUE, oldValue, this.value ); } catch ( final Throwable e ) { logger.warn ( "Failed to notify subscription change", e ); } }
@Override protected synchronized void stateChanged ( final DataItemValue value ) { logger.debug ( "state change: {}", value ); if ( value != null ) { if ( value.isConnected () || this.dontOverrideSubscription ) { this.sourceValue = value; } else { final Builder builder = new Builder ( value ); builder.setSubscriptionState ( SubscriptionState.CONNECTED ); this.sourceValue = builder.build (); } } else { final Builder builder = new Builder (); builder.setAttribute ( "master.source.error", Variant.TRUE ); builder.setAttribute ( "master.datasource.id", Variant.valueOf ( this.dataSourceId ) ); this.sourceValue = builder.build (); } reprocess (); }
builder.setSubscriptionState ( SubscriptionState.CONNECTED ); builder.setSubscriptionError ( null );