Class RemoteCatalogCache

java.lang.Object
org.jenkins.plugins.lockableresources.remote.RemoteCatalogCache

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Extension public class RemoteCatalogCache extends Object
Short-lived cache of what other servers publish, so the page can show it without waiting on them.

Rendering never performs the HTTP call: a page render hands back whatever snapshot exists and, if it has aged past the TTL, asks for a refresh in the background. A remote that is slow or down therefore costs a stale age indicator, not a page that hangs - display is best-effort, unlike lock acquisition, which stays fail-closed.

The TTL is deliberately short. The catalog carries live state (free, locked, reserved) and whether the remote is accepting new acquires, so a minute-old copy would be shown as if current.

  • Constructor Details

    • RemoteCatalogCache

      public RemoteCatalogCache()
  • Method Details

    • get

      public static RemoteCatalogCache get()
    • get

      @CheckForNull public RemoteCatalog get(@NonNull String serverId)
      The last snapshot for this server, refreshing in the background when it has gone stale.
      Returns:
      null when nothing has been fetched yet (a refresh has been started), or when the connection is unknown or switched off.
    • invalidateAll

      public void invalidateAll()
      Drops every snapshot - used when the remote configuration changes, and by tests.