Queues the supplied notification up to be dispatched to this abstract media's observers.
199468
public void queueNotification (ObserverList.ObserverOp<Object> amop)
    {
        if (_observers != null) {
            if (_mgr != null) {
                _mgr.queueNotification(_observers, amop);
            } else {
                log.warning("Have no manager, dropping notification", "media", this, "op", amop);
            }
        }
    }
1336562
def run(self, request_cb, notification_cb, setup_cb=None):
        
        self._request_cb = request_cb
        self._notification_cb = notification_cb
        self._is_running = True
        self._setup_exception = None
        self._loop_thread = threading.current_thread()

        def on_setup():
            try:
                setup_cb()
            except Exception as e:
                self._setup_exception = e
                self.stop()

        if setup_cb:
            # Create a new greenlet to handle the setup function
            gr = greenlet.greenlet(on_setup)
            gr.switch()

        if self._setup_exception:
            error('Setup error: {}'.format(self._setup_exception))
            raise self._setup_exception

        # Process all pending requests and notifications
        while self._pending_messages:
            msg = self._pending_messages.popleft()
            getattr(self, '_on_{}'.format(msg[0]))(*msg[1:])
        self._async_session.run(self._on_request, self._on_notification)
        self._is_running = False
        self._request_cb = None
        self._notification_cb = None
        self._loop_thread = None

        if self._setup_exception:
            raise self._setup_exception
915305
def GetNotifications(self, queue):
    """"""
    queue_shard = self.GetNotificationShard(queue)
    return self._GetUnsortedNotifications(queue_shard).values()
694808
def notify_observers(table, kind, primary_key=None):
    

    if IN_MIGRATIONS:
        return

    # Don't propagate events when there are no observers to receive them.
    if not Observer.objects.filter(dependencies__table=table).exists():
        return

    def handler():
        """Send a notification to the given channel."""
        try:
            async_to_sync(get_channel_layer().send)(
                CHANNEL_MAIN,
                {
                    'type': TYPE_ORM_NOTIFY,
                    'table': table,
                    'kind': kind,
                    'primary_key': str(primary_key),
                },
            )
        except ChannelFull:
            logger.exception("Unable to notify workers.")

    batcher = PrioritizedBatcher.global_instance()
    if batcher.is_started:
        # If a batch is open, queue the send via the batcher.
        batcher.add(
            'rest_framework_reactive', handler, group_by=(table, kind, primary_key)
        )
    else:
        # If no batch is open, invoke immediately.
        handler()
338740
def NotifyQueue(self, notification, **kwargs):
    """"""
    self._MultiNotifyQueue(notification.session_id.Queue(), [notification],
                           **kwargs)
75316
def handleNotification(self, handle, data):
        """"""
        _LOGGER.debug("Got notification from %s: %s", handle, codecs.encode(data, 'hex'))
        if handle in self._callbacks:
            self._callbacks[handle](data)
157574
protected void onServiceInstanceChanged(ServiceInstance instance){
        String serviceName = instance.getServiceName();
        synchronized(notificationHandlers){
            if(notificationHandlers.containsKey(serviceName)){
                for(NotificationHandler h : notificationHandlers.get(serviceName)){
                    h.serviceInstanceChange(instance);
                }
            }
        }
    }
1164890
@Override
    public <T> void send(NotificationType type, List<T> messages) throws NotificationException {
        String[] strMessages = new String[messages.size()];
        for (int index = 0; index < messages.size(); index++) {
            strMessages[index] = getMessageJson(messages.get(index));
        }
        sendInternal(type, strMessages);
    }
1169486
def send_notification(self, method, args, kwargs):
        """"""
        msg = dumps([1, method, args, kwargs])
        self.send(msg)
772848
public void notifyUpdate( URL resource, int expected, int count )
    {
        synchronized( m_Monitors )
        {
            for( StreamMonitor monitor : m_Monitors )
            {
                monitor.notifyUpdate( resource, expected, count );
            }
        }
    }
40554
def _handle_notification(self, method, params):
        """"""
        if method == CANCEL_METHOD:
            self._handle_cancel_notification(params['id'])
            return

        try:
            handler = self._dispatcher[method]
        except KeyError:
            log.warn("Ignoring notification for unknown method %s", method)
            return

        try:
            handler_result = handler(params)
        except Exception:  # pylint: disable=broad-except
            log.exception("Failed to handle notification %s: %s", method, params)
            return

        if callable(handler_result):
            log.debug("Executing async notification handler %s", handler_result)
            notification_future = self._executor_service.submit(handler_result)
            notification_future.add_done_callback(self._notification_callback(method, params))
1093475
def notifyAppend(self, queue, force):
        '''
        
        '''
        if not force and not self.canAppend():
            self.isWaited = True
            return self._matcher
        if self.parent is not None:
            m = self.parent.notifyAppend(self, force)
            if m is not None:
                return m
        self.totalSize = self.totalSize + 1
        return None
618936
public void sendNotification(final Notification notification) {

    ContextAwareTimer.Context timer = this.notificationTimer.time();
    if(!this.notificationTargets.isEmpty()) {
        for (final Map.Entry<UUID, Function<Notification, Void>> entry : this.notificationTargets.entrySet()) {
          try {
            entry.getValue().apply(notification);
          } catch (RuntimeException exception) {
            LOG.warn("RuntimeException when running notification target. Skipping.", exception);
          }
        }
    }

    if(getParent().isPresent()) {
      getParent().get().sendNotification(notification);
    }
    timer.stop();
  }
740170
def run(self):
        """"""
        retries = 0
        try:
            while not self._stopping:
                try:
                    data = self.notifications_api.long_poll_notifications()
                except mds.rest.ApiException as e:
                    # An HTTP 410 can be raised when stopping so don't log anything
                    if not self._stopping:
                        backoff = 2 ** retries - random.randint(int(retries / 2), retries)
                        LOG.error('Notification long poll failed with exception (retry in %d seconds):\n%s', backoff, e)
                        retries += 1
                        # Backoff for an increasing amount of time until we have tried 10 times, then reset the backoff.
                        if retries >= 10:
                            retries = 0
                        time.sleep(backoff)
                else:
                    handle_channel_message(
                        db=self.db,
                        queues=self.queues,
                        b64decode=self._b64decode,
                        notification_object=data
                    )
                    if self.subscription_manager:
                        self.subscription_manager.notify(data.to_dict())
        finally:
            self._stopped.set()
615632
protected function broadcast()
    {
        if (function_exists('broadcast')) {
            broadcast(new NotificationPushed($this->push));
        } elseif (function_exists('event')) {
            event(new NotificationPushed($this->push));
        }
    }
772405
def do_notify(self, line):
        

        def f(p, method, params):
            p.send_notification(method, params)

        self._request(line, f)
1269582
public function notify() {
        foreach($this->watchers as $watcher) {
          if ($this->stopNotify === true) {
              break;
          }

          $watcher->update($this);
        }
    }