Module jdk.jfr
Package jdk.jfr

Interface FlightRecorderListener


  • public interface FlightRecorderListener
    Callback interface to monitor Flight Recorder's life cycle.
    Since:
    9
    • Method Detail

      • recorderInitialized

        default void recorderInitialized​(FlightRecorder recorder)
        Receives notification when Flight Recorder is initialized.

        This method will also be invoked if a listener is added to an already initialized Flight Recorder.

        Purpose of this method is to allow clients to implement their own initialization mechanism and be guaranteed that it is executed before a FlightRecorder instance is returned by. FlightRecorder#getFlightRecorder().

        The implementation of this method should return as soon as possible, to avoid blocking initialization of Flight Recorder.

        The implementation of this method should not call FlightRecorder.getFlightRecorder() or start new recordings as it may lead to deadlocks or unexpected behavior.

        Implementation Requirements:
        The default implementation of this method is empty.
        Parameters:
        recorder - Flight Recorder instance, not null
        See Also:
        FlightRecorder.addListener(FlightRecorderListener)
      • recordingStateChanged

        default void recordingStateChanged​(Recording recording)
        Receives notification when a recording is changing its state.

        Callback will be invoked when a recording has reached the following states RUNNING, STOPPED and CLOSED. The implementation of this method should return as soon as possible so normal operation of Flight Recorder is not blocked.

        Implementation Requirements:
        The default implementation of this method is empty.
        Parameters:
        recording - the recording where the state change occurred, not null
        See Also:
        FlightRecorder.addListener(FlightRecorderListener), RecordingState