Class DumpsMixin

java.lang.Object
org.apache.juneau.rest.server.servlet.RestMixin
org.apache.juneau.rest.server.management.DumpsMixin

public class DumpsMixin extends RestMixin
Mixin flavor of the diagnostic dump endpoints (/threaddump, /heapdump).

Composes into a host resource via @Rest(mixins=DumpsMixin.class) and delegates to a shared DumpsManager worker so the mixin and resource flavors cannot drift.

Both dumps are deny-by-default — they respond 403 Forbidden unless a DumpsSettings bean enabling them is registered in the bean store. /heapdump additionally degrades to 501 Not Implemented on a JVM without HotSpot heap-dump support.

See Also:
Since:
10.0.0
  • Constructor Details

  • Method Details

    • manager

      protected DumpsManager manager(RestRequest req)
      Returns the DumpsManager worker, resolved from the host bean store when a consumer registers one, else a built-in default. Resolving through the bean store lets consumers (and tests) supply an alternate worker without subclassing.
      Parameters:
      req - The HTTP request (its context's bean store is searched).
      Returns:
      The resolved manager; never null.
    • getThreadDump

      [GET /threaddump] - Full thread dump from the ThreadMXBean.

      Deny-by-default: responds 403 unless enabled via DumpsSettings.

      Parameters:
      req - The HTTP request.
      Returns:
      The thread dump text.
      Throws:
      Forbidden - If the thread-dump endpoint is not enabled.
    • getHeapDump

      [GET /heapdump] - HotSpot heap dump (hprof) stream.

      Deny-by-default: responds 403 unless enabled via DumpsSettings; 501 on a JVM without HotSpot heap-dump support.

      Parameters:
      req - The HTTP request.
      res - The HTTP response.
      Returns:
      A self-deleting stream over the hprof file.
      Throws:
      Forbidden - If the heap-dump endpoint is not enabled.
      NotImplemented - If this JVM has no HotSpot heap-dump support.
      IOException - If the dump could not be produced.