An observer which sends the state change to the proxy.
515007
def _update_proxy(self, change):
        
        if change['type'] in ['event', 'update'] and self.proxy_is_active:
            handler = getattr(self.proxy, 'set_' + change['name'], None)
            if handler is not None:
                handler(change['value'])
652849
@Override
    public void accept(ClassWriterOutputVisitor visitor) throws IOException {
        proxyBeanDefinitionWriter.accept(visitor);
        try (OutputStream out = visitor.visitClass(proxyFullName)) {
            out.write(classWriter.toByteArray());
            for (ExecutableMethodWriter method : proxiedMethods) {
                method.accept(visitor);
            }
        }
    }
883721
def async_state_change_callback(self, addr, state, value):
        """"""
        _LOGGING.info('Device %s state %s value is changed to %s',
                      addr, state, value)
742993
def register_on_machine_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_machine_state_changed
        return self.event_source.register_callback(callback, event_type)
553324
def _on_state_changed(self):
        """"""
        raw_state, generation = self.state.raw_state_and_generation
        if generation != self._last_generation:
            self._last_generation = generation
            self._send_update(raw_state, generation)
264647
function publishChanges (eventName, stateId) {
      var subscriptions = instanceSubscriptions[instanceId];

      if(!subscriptions) return;

      subscriptions.forEach(function (response) {
        response.write('event: ' + eventName +'\n');
        response.write('data: ' + stateId + '\n\n');
      });
    }
59034
def handle_and_track_state_change(self, state_change: StateChange):
        
        for greenlet in self.handle_state_change(state_change):
            self.add_pending_greenlet(greenlet)
999950
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      log.debug("State changed: {}", state);
    }
  }
246861
def state_transition(
        mediator_state: Optional[MediatorTransferState],
        state_change: StateChange,
        channelidentifiers_to_channels: ChannelMap,
        nodeaddresses_to_networkstates: NodeNetworkStateMap,
        pseudo_random_generator: random.Random,
        block_number: BlockNumber,
        block_hash: BlockHash,
) -> TransitionResult[MediatorTransferState]:
    
    # pylint: disable=too-many-branches
    # Notes:
    # - A user cannot cancel a mediated transfer after it was initiated, she
    #   may only reject to mediate before hand. This is because the mediator
    #   doesn't control the secret reveal and needs to wait for the lock
    #   expiration before safely discarding the transfer.

    iteration = TransitionResult(mediator_state, list())

    if type(state_change) == ActionInitMediator:
        assert isinstance(state_change, ActionInitMediator), MYPY_ANNOTATION
        if mediator_state is None:
            iteration = handle_init(
                state_change=state_change,
                channelidentifiers_to_channels=channelidentifiers_to_channels,
                nodeaddresses_to_networkstates=nodeaddresses_to_networkstates,
                pseudo_random_generator=pseudo_random_generator,
                block_number=block_number,
            )

    elif type(state_change) == Block:
        assert isinstance(state_change, Block), MYPY_ANNOTATION
        assert mediator_state, 'Block should be accompanied by a valid mediator state'
        iteration = handle_block(
            mediator_state=mediator_state,
            state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            pseudo_random_generator=pseudo_random_generator,
        )

    elif type(state_change) == ReceiveTransferRefund:
        assert isinstance(state_change, ReceiveTransferRefund), MYPY_ANNOTATION
        msg = 'ReceiveTransferRefund should be accompanied by a valid mediator state'
        assert mediator_state, msg
        iteration = handle_refundtransfer(
            mediator_state=mediator_state,
            mediator_state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            nodeaddresses_to_networkstates=nodeaddresses_to_networkstates,
            pseudo_random_generator=pseudo_random_generator,
            block_number=block_number,
        )

    elif type(state_change) == ReceiveSecretReveal:
        assert isinstance(state_change, ReceiveSecretReveal), MYPY_ANNOTATION
        msg = 'ReceiveSecretReveal should be accompanied by a valid mediator state'
        assert mediator_state, msg
        iteration = handle_offchain_secretreveal(
            mediator_state=mediator_state,
            mediator_state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            pseudo_random_generator=pseudo_random_generator,
            block_number=block_number,
            block_hash=block_hash,
        )

    elif type(state_change) == ContractReceiveSecretReveal:
        assert isinstance(state_change, ContractReceiveSecretReveal), MYPY_ANNOTATION
        msg = 'ContractReceiveSecretReveal should be accompanied by a valid mediator state'
        assert mediator_state, msg
        iteration = handle_onchain_secretreveal(
            mediator_state=mediator_state,
            onchain_secret_reveal=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            pseudo_random_generator=pseudo_random_generator,
            block_number=block_number,
        )

    elif type(state_change) == ReceiveUnlock:
        assert isinstance(state_change, ReceiveUnlock), MYPY_ANNOTATION
        assert mediator_state, 'ReceiveUnlock should be accompanied by a valid mediator state'
        iteration = handle_unlock(
            mediator_state=mediator_state,
            state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
        )

    elif type(state_change) == ReceiveLockExpired:
        assert isinstance(state_change, ReceiveLockExpired), MYPY_ANNOTATION
        assert mediator_state, 'ReceiveLockExpired should be accompanied by a valid mediator state'
        iteration = handle_lock_expired(
            mediator_state=mediator_state,
            state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            block_number=block_number,
        )
    elif type(state_change) == ActionChangeNodeNetworkState:
        assert isinstance(state_change, ActionChangeNodeNetworkState), MYPY_ANNOTATION
        msg = 'ActionChangeNodeNetworkState should be accompanied by a valid mediator state'
        assert mediator_state, msg
        iteration = handle_node_change_network_state(
            mediator_state=mediator_state,
            state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            pseudo_random_generator=pseudo_random_generator,
            block_number=block_number,
        )

    # this is the place for paranoia
    if iteration.new_state is not None:
        assert isinstance(iteration.new_state, MediatorTransferState)
        sanity_check(iteration.new_state, channelidentifiers_to_channels)

    return clear_if_finalized(iteration, channelidentifiers_to_channels)
1362572
def pre_change_receiver(self, instance: Model, action: Action):
        
        if action == Action.CREATE:
            group_names = set()
        else:
            group_names = set(self.group_names(instance))

        # use a thread local dict to be safe...
        if not hasattr(instance, '__instance_groups'):
            instance.__instance_groups = threading.local()
            instance.__instance_groups.observers = {}
        if not hasattr(instance.__instance_groups, 'observers'):
            instance.__instance_groups.observers = {}

        instance.__instance_groups.observers[self] = group_names
231391
def update(self):
        '''
        
        '''
        if self.hasproxy():
            irD = IRData()
            received = 0
            data = self.proxy.getIRData()

            irD.received = data.received

            self.lock.acquire()
            self.ir = irD
            self.lock.release()
480066
def register_on_session_state_changed(self, callback):
        
        event_type = library.VBoxEventType.on_session_state_changed
        return self.event_source.register_callback(callback, event_type)
742913
def state_change_handler(self, evt):
        """"""
        datapath = evt.datapath
        assert datapath is not None
        if datapath.id == self._querier.dpid:
            if evt.state == MAIN_DISPATCHER:
                self._querier.start_loop(datapath)
            elif evt.state == DEAD_DISPATCHER:
                self._querier.stop_loop()
884565
def state(self, state):
        ''''''
        logger.debug('client changing to state=%s', ClientState.Names[state])
        self._state = state
550628
def _track_modify(self, cls, name, detail, keep, trace):
        
        self._observers[cls].modify(name, detail, keep, trace)
854138
function(tick) {
		var snapshot, handlers, observers = this._observers;
		if (tick.type === edb.TICK_PUBLISH_CHANGES) {
			snapshot = gui.Object.copy(this._changes);
			this._changes = Object.create(null);
			gui.Object.each(snapshot, function(instanceid, changes) {
				if ((handlers = observers[instanceid])) {
					handlers.forEach(function(handler) {
						handler.onchange(changes);
					});
				}
			});
		}
	}
810745
private void dispatchState(State state) {
		for (MeasureDistanceHandler handler : handlers) {
			handler.onChange(state, context);
		}	
	}