Class JeyzerPublisher

  • All Implemented Interfaces:

    public abstract class JeyzerPublisher
    extends java.lang.Object
    implements JeyzerMXBean

    Jeyzer Publisher is the entry point to expose process context parameters and obtain action handlers.
    Process context parameters are String value pairs which represent dynamic values (ex : number of connected users) or constant values (ex : application version)
    Action handlers permit to expose thread context parameters (ex : number of database inserts) and declare Jzr actions which permit to create - at Jeyzer analysis time - thread units across time.

    Jeyzer Publisher is also the place to generate JZR monitoring events through monitor handlers. Those applicative events can either be one shot (see fire methods) or time ranged (see start and terminate methods). Time ranged events do represent high level applicative events such as service interruptions. One shot events do represent high level applicative events such as state transitions.

    Jeyzer Publisher is singleton accessible through the JeyzerPublisher.instance() call.
    Jeyzer Publisher singleton is instantiated at class loading time and :

    • registers itself as a Jeyzer MX bean.
    • starts a stale action context reaper (daemon thread) which can be disabled with the publisher.disable.action.context.reaper init property.

    By default, the Jeyzer Publisher is active.
    If your application is considered as stable enough or/and if you're looking for high end performance, Jeyzer Publisher can be disabled by setting the system property to false in which case an empty implementation is loaded, limiting the memory footprint.

    Jeyzer Publisher can be configured - optionally - only once through the init method. Supported properties are described in JeyzerPublisherInit

    The Jeyzer Publisher can also generate JZR publisher life cycle events such as data collection activation/deactivation.
    Those events help to understand at JZR report analysis time if the applicative events or data were published.

    Thread safe.
    The implementation doesn't throw exceptions : invalid parameters will be simply ignored and without effect.
    It is up to the application to provide the right inputs.

    See Also:
    • Constructor Detail

      • JeyzerPublisher

        public JeyzerPublisher()
    • Method Detail

      • instance

        public static JeyzerPublisher instance()
        Gets the Jeyzer Publisher unique instance
        the Jeyzer publisher instance
      • init

        public abstract boolean init​(java.util.Properties props)
        Initialize the Jeyzer publisher. Optional. Supported properties are listed in JeyzerPublisherInit
        props - the initialization properties
        true if the initialization occurred
      • setProfileName

        public abstract void setProfileName​(java.lang.String profile)
        Set the Jeyzer applicative profile name.
        profile - the profile name
      • setNodeName

        public abstract void setNodeName​(java.lang.String nodeName)
        Set the process or node name. By default set with the underlying machine host name.
        nodeName - the node name
      • setProcessName

        public abstract void setProcessName​(java.lang.String name)
        Set the process name.
        name - the process name
      • setProcessVersion

        public abstract void setProcessVersion​(java.lang.String version)
        Set the process version.
        version - the process version
      • setProcessBuildNumber

        public abstract void setProcessBuildNumber​(java.lang.String buildNumber)
        Set the process build number if any.
        buildNumber - the build number
      • addStaticProcessContextParam

        public abstract void addStaticProcessContextParam​(java.lang.String key,
                                                          java.lang.String value)
        Reports a static process context parameter to Jeyzer. Static process context parameters are published as process card properties : those must be set at process start.
        key - the static process context parameter key
        value - the static process context parameter value
      • setDynamicProcessContextParam

        public abstract void setDynamicProcessContextParam​(java.lang.String key,
                                                           java.lang.String value)
        Reports a dynamic process context parameter to Jeyzer
        key - the dynamic process context parameter key
        value - the dynamic process context parameter value
      • removeDynamicProcessContextParam

        public abstract void removeDynamicProcessContextParam​(java.lang.String key)
        Removes a dynamic process context parameter to Jeyzer
        key - the dynamic process context parameter key
      • getMonitorHandler

        public abstract JzrMonitorHandler getMonitorHandler​(java.lang.String source,
                                                            java.lang.String service)
        Get a Jeyzer monitor handler to generate events
        source - the applicative source. Nullable. By default the process name if available.
        service - the dynamic process context parameter value. Can be null
        the Jeyzer monitor handler
      • getActionHandler

        public abstract JzrActionHandler getActionHandler()
        Get a Jeyzer action handler
        the Jeyzer action handler
      • getPublisherVersion

        public java.lang.String getPublisherVersion()
        Description copied from interface: JeyzerMXBean
        Get the Jeyzer publish library version
        Specified by:
        getPublisherVersion in interface JeyzerMXBean
        the Jeyzer publish library version