Interface ProfilerBackend
- All Known Implementing Classes:
BinaryBackend,LibraryBackend
LibraryBackend, when the maven dependency is on the classpath) or the external binary
(BinaryBackend, when ASYNC_PROFILER_HOME is set).
This file deliberately contains no import of one.profiler.AsyncProfiler. That import is
isolated in LibraryBackend so that binary-only deployments never trigger a
NoClassDefFoundError when this class is loaded.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voiddestroy()Cleans up any resources (e.g.static ProfilerBackendDetects which backend is available.executeStart(ProfileServlet.ProfileRequest request, File outputFile) Executes a profiling start command and returns the profiler's response.executeStop(ProfileServlet.ProfileRequest request, File outputFile) Executes a profiling stop/dump command.
-
Field Details
-
LOG
-
-
Method Details
-
executeStart
Executes a profiling start command and returns the profiler's response.- Throws:
IOException
-
executeStop
Executes a profiling stop/dump command.- Throws:
IOException
-
destroy
Cleans up any resources (e.g. kills a running process). Called on servlet destroy. -
detect
Detects which backend is available. PrefersLibraryBackendoverBinaryBackend. Returnsnullif neither is available.Detection runs once at class-load time (via
DETECTED_BACKENDinProfileServlet). A library that becomes loadable after the JVM starts requires a restart to be detected. A library that resolves at class-load but whose native binary is incompatible with the OS/kernel will not surface the error here — it will throw anErrororRuntimeExceptionon the firstexecute()call at request time.When both the library and a binary home are available,
LibraryBackendis preferred andASYNC_PROFILER_HOMEis ignored.LibraryBackendis instantiated reflectively so that its class — and thereforeone.profiler.AsyncProfiler— is never loaded on systems where the JAR is absent.
-