Creates an alarm that binds this check with a notification plan.
10486
def create_alarm(self, notification_plan, criteria=None, disabled=False,
            label=None, name=None, metadata=None):
        
        return self.manager.create_alarm(self.entity, self, notification_plan,
                criteria=criteria, disabled=disabled, label=label, name=name,
                metadata=metadata)
402554
private void scheduleAlarm() {
    if (wasCalledViaHTTP || retry >= maxNumberOfRetries) {
      // No alarm necessary anymore.
      LOG.log(Level.INFO,
          "Not scheduling additional alarms after {0} out of max {1} retries. The HTTP handles was called: ",
          new Object[] {retry, maxNumberOfRetries, wasCalledViaHTTP});
      return;
    }

    // Scheduling an alarm will prevent the clock from going idle.
    ++retry;
    clock.scheduleAlarm(alarmInterval, alarmHandler);
  }
1291570
def send_alert_to_subscribed_integrations(alert):
    """"""
    valid_configured_integrations = get_valid_configured_integrations(alert)

    for configured_integration in valid_configured_integrations:
        threading.Thread(target=create_integration_alert_and_call_send, args=(alert, configured_integration)).start()
502984
public void alarm(Object alarmContext)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "alarm", alarmContext);

    // Alarm context should be an sid, make it so.
    SIBUuid12 sid = (SIBUuid12) alarmContext;

    // synchronized here in case we're racing with an answer to our
    // query.
    synchronized (flushMap)
    {
      // See if the query record is still around
      FlushQueryRecord entry = flushMap.get(sid);

      if (entry != null)
      {
        // Query still active, see if we need to restart.
        entry.attempts--;
        if (entry.attempts > 0)
        {
          // Yup, resend the query and reset the alarm.  If
          // entry.cached is null, then this is a "request flush"
          // rather than an "are you flushed".
          try
          {
            if (entry.cache == null)
            {
              upControl.sendRequestFlushMessage(entry.source,
                                                entry.destId,
                                                entry.busId,
                                                entry.requestID,
                                                sid,
                                                false);  //TODO check indoubtDiscard
            }
            else
            {
              upControl.sendAreYouFlushedMessage(entry.source,
                                                 entry.destId,
                                                 entry.busId,
                                                 entry.requestID, sid);
            }
          }
          catch (SIResourceException e)
          {
            // No FFDC code needed

            // If we run out of resources, then give up on the query
            // and log an error.  This is probably only important for
            // "request flush" queries.
            flushMap.remove(sid);

            // TODO: actually, this should be an admin message.
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
              SibTr.event(tc, "Flush query failed for stream: " + sid);
          }

        }
        else
        {
          // Nope, didn't work.  Remove the query record, log the event,
          // and exit.
          flushMap.remove(sid);
          // TODO: actually, this should be an admin message.
          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            SibTr.event(tc, "Flush query expired for stream: " + sid);
        }
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");
  }
271193
def update_alarm(self, entity, alarm, criteria=None, disabled=False,
            label=None, name=None, metadata=None):
        
        return entity.update_alarm(alarm, criteria=criteria, disabled=disabled,
            label=label, name=name, metadata=metadata)
1094812
public synchronized void enableAlarm() {
    if (!this.isAlarmEnabled) {
      LOG.log(Level.FINE, "Enabling the alarm and scheduling it to fire in {0} ms.", this.taskStatusCheckPeriod);
      this.isAlarmEnabled = true;
      this.scheduleAlarm();
    } else {
      LOG.log(Level.FINE, "Alarm is already enabled.");
    }
  }
955800
@RequiresApi(api = Build.VERSION_CODES.O)
  public static void setupNotificationChannel() {
    NotificationManager manager
      = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
    NotificationChannel channel = new NotificationChannel(OfflineConstants.NOTIFICATION_CHANNEL,
      "Offline", NotificationManager.IMPORTANCE_DEFAULT);
    channel.setLightColor(Color.GREEN);
    channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
    manager.createNotificationChannel(channel);
  }
625785
def create_alarm(panel_json, abode, area='1'):
    """"""
    panel_json['name'] = CONST.ALARM_NAME
    panel_json['id'] = CONST.ALARM_DEVICE_ID + area
    panel_json['type'] = CONST.ALARM_TYPE
    panel_json['type_tag'] = CONST.DEVICE_ALARM
    panel_json['generic_type'] = CONST.TYPE_ALARM

    return AbodeAlarm(panel_json, abode, area)
1098294
def _notify_receiver(self, receiver, params, doc):
        """"""
        verb = VMAP[doc['op']]
        ns = doc['ns']
        notification_id = Id(ns + 'Notification:' + str(ObjectId()) + '@' + params['authority'])
        object_id = Id(ns + ':' + str(doc['o']['_id']) + '@' + params['authority'])
        try:
            getattr(receiver, '_'.join([verb, params['obj_name_plural']]))(notification_id, [object_id])
        except AttributeError:
            pass
        return notification_id
472624
def prepare_notification(self, *, subscribers=None, instance=None,
                             loop=None, notify_external=True):
        """"""
        # merge callbacks added to the class level with those added to the
        # instance, giving the formers precedence while preserving overall
        # order
        self_subscribers = self.subscribers.copy()
        # add in callbacks declared in the main class body and marked with
        # @handler
        if (instance is not None and self.name and
            isinstance(instance.__class__, SignalAndHandlerInitMeta)):
            class_handlers = type(instance)._get_class_handlers(
                self.name, instance)
            for ch in class_handlers:
                # eventual methods are ephemeral and normally the following
                # condition would always be True for methods but the dict used
                # has logic to take that into account
                if ch not in self_subscribers:
                    self_subscribers.append(ch)
        # add in the other instance level callbacks added at runtime
        if subscribers is not None:
            for el in subscribers:
                # eventual methods are ephemeral and normally the following
                # condition would always be True for methods but the dict used
                # has logic to take that into account
                if el not in self_subscribers:
                    self_subscribers.append(el)
        loop = loop or self.loop
        # maybe do a round of external publishing
        if notify_external and self.external_signaller is not None:
            self_subscribers.append(partial(self.ext_publish, instance, loop))
        if self._fnotify is None:
            fnotify = None
        else:
            if instance is None:
                fnotify = self._fnotify
            else:
                fnotify = types.MethodType(self._fnotify, instance)
        validator = self._fvalidation
        if validator is not None and instance is not None:
            validator = types.MethodType(validator, instance)
        return Executor(self_subscribers, owner=self,
                        concurrent=SignalOptions.EXEC_CONCURRENT in self.flags,
                        loop=loop, exec_wrapper=fnotify,
                        fvalidation=validator)
863968
protected static void addAlarm(Object key, Object alarmObject)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "addAlarm", new Object[] { key, alarmObject });

        synchronized (pendingAlarms)
        {
            Set alarms = null;
            if (pendingAlarms.containsKey(key))
                alarms = (Set) pendingAlarms.get(key);
            else
            {
                alarms = new HashSet();
                pendingAlarms.put(key, alarms);
            }
            alarms.add(alarmObject);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "addAlarm");
    }
645834
@Override
    @Transactional
    public synchronized void startAlertScheduling() {
        requireNotDisposed();
        if (_alertSchedulingThread != null && _alertSchedulingThread.isAlive()) {
            _logger.info("Request to start alert scheduling aborted as it is already running.");
        } else {
            _logger.info("Starting alert scheduling thread.");
            _alertSchedulingThread = new SchedulingThread("schedule-alerts", LockType.ALERT_SCHEDULING);
            _alertSchedulingThread.start();
            _logger.info("Alert scheduling thread started.");
        }
    }
1221321
public synchronized void addObserver(String notification, ApptentiveNotificationObserver observer, boolean useWeakReference) {
		final ApptentiveNotificationObserverList list = resolveObserverList(notification);
		list.addObserver(observer, useWeakReference);
	}
1223255
def _update_notification(self, message=None):
        """"""
        if message is None:
            message = ''
        message_label = self._parts['notification label']
        message_label.config(text=message)
        self._base.update()
218399
def do_alarm_update(mc, args):
    ''''''
    fields = {}
    fields['alarm_id'] = args.id
    if args.state.upper() not in state_types:
            errmsg = ('Invalid state, not one of [' +
                      ', '.join(state_types) + ']')
            print(errmsg)
            return
    fields['state'] = args.state
    fields['lifecycle_state'] = args.lifecycle_state
    fields['link'] = args.link
    try:
        alarm = mc.alarms.update(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(alarm, indent=2))
925189
public void alarm(Object alarmContext)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "alarm", alarmContext);

    synchronized (this)
    {
      iAlarmCancelled = true;

      // Did the request message fail
      if (iRequestFailed)
      {
        iRequestFailed = false;

        // Get the reset subscription list.
        SubscriptionMessage message = iBusGroup.generateResetSubscriptionMessage();
        message.setSubscriptionMessageType(SubscriptionMessageType.REQUEST);

        // If there is a reset message to send, then send it.
        LocalTransaction transaction = iProxyHandler.getMessageProcessor().getTXManager().createLocalTransaction(true);

        try
        {
          // Send to the list of all neighbours.
          sendToNeighbour(message, (Transaction) transaction);

          transaction.commit();

        }
        catch (SIException e)
        {
          // No FFDC code needed
          SibTr.exception(tc, e);

          iRequestFailed = true;
        }

        // Kick off a new timer to wait for the proxy response.
        setRequestedProxySubscriptions();

      }
      // Was the request actually sent
      else if (iRequestSent)
      {
        String meName = JsAdminUtils.getMENameByUuidForMessage(iMEUuid.toString());
        if (meName == null)
          meName = iMEUuid.toString();

        SibTr.push(iProxyHandler.getMessageProcessor().getMessagingEngine());
        SibTr.warning(tc, "NO_NEIGHBOUR_REPLY_WARNING_CWSIP0381", new Object[]{meName});
        SibTr.pop();
      }

    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");
  }
235240
protected function setHandlerAlarm()
    {
        $handler = new SignalAlarm($this->control, $this->action, $this->context);
        $this->control->signal()->setHandler('alarm', $handler);
        $this->control->signal()->alarm($this->context->timeout);
    }