## JProfiler API documentation

## com.jprofiler.api.agent.probe
Interface ProbeContext

All Known Subinterfaces:
  InterceptorContext

    public interface ProbeContext

Context object that is passed to probes and provide ways to publish data. An object of this class is passed to telemetry probes in `TelemetryProbe.fillTelemetryData(ProbeContext, int[])`, the derived `InterceptorContext` is passed to the interception methods of `interceptor probes`.

The help topic on custom probes in the bundled documentation explains how to develop custom probes.

Method Summary
`void` | `addEvent(ProbeEvent probeEvent)` Publishes an event.
`ProbeEvent` | `createCloseEvent(java.lang.String description, java.lang.Object controlObject)` Creates an event for closing a control object.
`ProbeEvent` | `createCustomEvent(java.lang.String description, int type, java.lang.Object controlObject)` Creates a custom event.
`ProbeEvent` | `createOpenEvent(java.lang.String description, java.lang.Object controlObject)` Creates an event for opening a control object.
`ProbeEvent` | `createOpenEvent(java.lang.String description, java.lang.Object controlObject, java.lang.Object[] controlObjectData)` Creates an event for opening a control object with additional control object data.
`java.util.Map` | `getMap()` Returns a map for storing arbitrary data.
`boolean` | `isRecording()` Return whether the probe is recording data.

Method Detail

### getMap

    java.util.Map getMap()

  Returns a map for storing arbitrary data. This is useful for custom probes that are defined the JProfiler GUI. In that case, you do not write your own classes that could have fields for storing data, but you just provide the necessary scripts.

  Returns:
    the map

### createOpenEvent

    ProbeEvent createOpenEvent(java.lang.String description,
                               java.lang.Object controlObject)

  Creates an event for opening a control object. The probe meta data method `ProbeMetaData.controlObjectView(boolean)` has to be called with the argument `true` in the `meta data configuration method`.

  Note that the returned event must be published with `addEvent(ProbeEvent)`, otherwise the event will be discarded.

  Parameters:
    `description` - the description for the event
    `controlObject` - the control object that is being opened
  Returns:
    the probe event

### createOpenEvent

    ProbeEvent createOpenEvent(java.lang.String description,
                               java.lang.Object controlObject,
                               java.lang.Object[] controlObjectData)

  Creates an event for opening a control object with additional control object data. Same as `createOpenEvent(String, Object)` only with additional control object data as defined by calls to `ProbeMetaData.addAdditionalControlObjectData(String, DataType, boolean)`. The array must has the same length as the number of calls to that method during the meta data configuration.

  Note that the returned event must be published with `addEvent(ProbeEvent)`, otherwise the event will be discarded.

  Parameters:
    `description` - the description for the event
    `controlObject` - the control object that is being opened
    `controlObjectData` - the additional data for the control object
  Returns:
    the probe event

### createCloseEvent

    ProbeEvent createCloseEvent(java.lang.String description,
                                java.lang.Object controlObject)

  Creates an event for closing a control object. The control object must previously have been opened with the `createOpenEvent(String, Object)` or `createOpenEvent(String, Object, Object[])` method.

  Note that the returned event must be published with `addEvent(ProbeEvent)`, otherwise the event will be discarded.

  Parameters:
    `description` - the description for the event
    `controlObject` - the control object that is being closed
  Returns:
    the probe event

### createCustomEvent

    ProbeEvent createCustomEvent(java.lang.String description,
                                 int type,
                                 java.lang.Object controlObject)

  Creates a custom event. The various custom events are defined with a call to `ProbeMetaData.customTypeNames(String[])` in the `meta data configuration method`.

  Note that the returned event must be published with `addEvent(ProbeEvent)`, otherwise the event will be discarded.

  Parameters:
    `description` - the description for the event
    `type` - the type corresponds to the index of the desired custom event in the the call to `ProbeMetaData.customTypeNames(String[])`
    `controlObject` - the control object that is associated with this event. May be `null`.
  Returns:
    the probe event

### addEvent

    void addEvent(ProbeEvent probeEvent)

  Publishes an event. If single event recording is enabled, you can see the event in the events view of the probe. Otherwise it will only be used for control object management and calculation of sum columns.

  Parameters:
    `probeEvent` - the probe event that should be published

### isRecording

    boolean isRecording()

  Return whether the probe is recording data. The probe will record data on startup unless you called `ProbeMetaData.recordOnStartup(boolean)` with the argument `false` in the `meta data configuration method`. Furthermore, the user can start and stop recording the JProfiler GUI.

  Returns:
    the value