Class NotificationDispatcher

java.lang.Object
io.jenkins.plugins.batchcontrol.ops.NotificationDispatcher

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class NotificationDispatcher extends Object
Hands request events to every BatchControlNotifier on a background thread (D-36). Callers (the policy services and the expiry work) call it after the state change is persisted. Nothing here can fail or delay the calling request: building the notification, submission and every notifier call are guarded, and failures are only logged.
  • Field Details

    • MOVED_NOTICE

      public static final String MOVED_NOTICE
      D-75 (1), S-39-04: the fixed sentence of a notice whose window followed its item to a name the recipient may not read; the notice then names the approved name instead. A fixed sentence from the plugin, never user input (it is shown with the other notices, D-38a).
      See Also:
  • Method Details

    • shutdown

      @Terminator public static void shutdown()
      Stops the notifier thread when Jenkins shuts down: no new work is accepted, pending notifications are discarded, and a running delivery gets a short grace period before it is interrupted. The next Jenkins session in the same JVM (tests) gets a fresh executor.
    • run

      public static void run(NotificationEvent event, RunRequest request)
      Event for a run request. Recipients follow the D-36 rule for the event.
    • grant

      public static void grant(NotificationEvent event, GrantRequest request)
      Event for a change (grant) request. Recipients follow the D-36 rule for the event.
    • grantApproved

      public static void grantApproved(GrantRequest request, @CheckForNull String endedAtOnceBecause)
      NotificationEvent.APPROVED for a change request, sent to its requester.

      Owner decision 2026-10-06 (D-71c (3), D-75 (2)): when the window ended at once because its item was deleted after the approval checked it and before the window was registered, the notice is still APPROVED (no other notice type) and carries one more details line, first, saying so: Window: ended at once — <reason>.

      Parameters:
      endedAtOnceBecause - why the window ended at registration (for example Grant.REVOKED_ITEM_DELETED), or null when it is in effect
    • activation

      public static void activation(NotificationEvent event, ActivationRequest request)
      Event for an activation or hold request (SPEC item 6a). Recipients follow the D-36 rule for the event; the kind is Notification.KIND_ACTIVATION.
    • runEnded

      public static void runEnded(NotificationEvent event, RunRequest request, boolean wasPending, @CheckForNull String reason)
      D-54: NotificationEvent.CANCELLED, NotificationEvent.EXPIRED or NotificationEvent.INVALIDATED for a run request that ended without a decision.
      Parameters:
      wasPending - whether the request was PENDING when it ended (its approvers are told)
      reason - why it ended, shown in the message; may be null
    • grantEnded

      public static void grantEnded(NotificationEvent event, GrantRequest request, boolean wasPending, @CheckForNull String reason)
    • activationEnded

      public static void activationEnded(NotificationEvent event, ActivationRequest request, boolean wasPending, @CheckForNull String reason)
    • grantExpiring

      public static void grantExpiring(Grant grant, @CheckForNull GrantRequest request)
      NotificationEvent.GRANT_EXPIRING for an active window, sent to its holder.

      D-75 (1), security-39 S-39-04: the window follows its item when an administrator renames or moves it (D-74 (3)), possibly into a folder its holder cannot read. The notice therefore names the item's current full name only when the holder may read the item now (recipientMayRead(java.lang.String, java.lang.String), checked as the holder); otherwise it names the approved name (the request's scope) with the fixed MOVED_NOTICE. A window whose name did not change is named as before, without any check. This is the only notice that names a window's current scope: every other change request notice names the request's own scope, which is the approved name and never follows the item.

      Parameters:
      request - the change request the window came from, or null when it cannot be read; then the approved name is unknown, and a window whose current item the holder cannot read is not named at all: the notice is not sent (logged)