Class AdminProvider

java.lang.Object
org.apache.juneau.rest.server.ops.AdminProvider

public class AdminProvider extends Object
Flavor-neutral operational-introspection worker bean shared by the admin @Rest flavors.

Holds the capability state (the name-keyed cache-flush hooks + the thread-name-prefix exclude list) and the serve logic for the four admin endpoints (thread dump, heap statistics, cache flush, and rate-limit-bucket inspection). The AdminMixin (mixin), AdminResource (child), and AdminServlet (servlet) flavors are independent @Rest classes that each hold an AdminProvider worker and delegate to it — so the three deployment forms cannot drift, and no flavor is another flavor's worker.

See Also:
Since:
10.0.0
  • Field Details

    • DEFAULT_THREAD_NAME_PREFIX_EXCLUDE

      Default thread-name-prefix exclude list: filter out JVM internals, servlet container, and Spring Boot infrastructure threads.
  • Constructor Details

    • AdminProvider

      public AdminProvider()
      No-arg constructor — uses the default thread filter and no cache-flush hooks.
    • AdminProvider

      Builder constructor.
      Parameters:
      builder - The builder. Must not be null.
  • Method Details

    • create

      public static AdminProvider.Builder create()
      Creates a new builder.
      Returns:
      A new builder.
    • serveThreads

      public void serveThreads(RestResponse res) throws IOException
      Serves the thread dump as a JSON list of currently-live threads.
      Parameters:
      res - The current REST response. Must not be null.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • serveHeap

      public void serveHeap(RestResponse res) throws IOException
      Serves JVM heap and non-heap memory statistics.
      Parameters:
      res - The current REST response. Must not be null.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • serveCacheFlush

      public void serveCacheFlush(RestRequest req, RestResponse res) throws IOException
      Runs all registered cache-flush hooks (or a subset).

      When names is supplied, only the named hooks are invoked. Unknown names are silently ignored (404-on-unknown would leak the registered hook set). Hook execution is synchronous; long-running hooks block the request thread.

      Parameters:
      req - The current REST request — names query parameter is read off it. Must not be null.
      res - The current REST response. Must not be null.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • serveRateLimit

      public void serveRateLimit(RestRequest req, RestResponse res) throws IOException
      Serves the registered RateLimitGuard bean configuration.

      Returns 404 Not Found when no RateLimitGuard bean is registered.

      Parameters:
      req - The current REST request — supplies the bean store for guard lookup. Must not be null.
      res - The current REST response. Must not be null.
      Throws:
      IOException - If an I/O error occurs while writing the response.
      NotFound - If no RateLimitGuard bean is registered on the importer's bean store.
    • getCacheFlushHooks

      Returns the registered cache-flush hooks (test/inspection helper).
      Returns:
      The hooks, keyed by registration name. Never null.
    • getThreadNamePrefixExclude

      Returns the configured thread-name-prefix exclude list (test/inspection helper).
      Returns:
      The exclude list. Never null.