Class JeyzerPublisher
- java.lang.Object
-
- org.jeyzer.publish.JeyzerPublisher
-
- All Implemented Interfaces:
JeyzerMXBean
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 applicativeevents
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 thejeyzer.publisher.active
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 inJeyzerPublisherInit
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:
JeyzerPublisherInit
-
-
Field Summary
-
Fields inherited from interface org.jeyzer.mx.JeyzerMXBean
JEYZER_MXBEAN_NAME
-
-
Constructor Summary
Constructors Constructor Description JeyzerPublisher()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addStaticProcessContextParam(java.lang.String key, java.lang.String value)
Reports a static process context parameter to Jeyzer.abstract JzrActionHandler
getActionHandler()
Get a Jeyzer action handlerabstract JzrMonitorHandler
getMonitorHandler(java.lang.String source, java.lang.String service)
Get a Jeyzer monitor handler to generate eventsjava.lang.String
getPublisherVersion()
Get the Jeyzer publish library versionabstract boolean
init(java.util.Properties props)
Initialize the Jeyzer publisher.static JeyzerPublisher
instance()
Gets the Jeyzer Publisher unique instanceabstract void
removeDynamicProcessContextParam(java.lang.String key)
Removes a dynamic process context parameter to Jeyzerabstract void
setDynamicProcessContextParam(java.lang.String key, java.lang.String value)
Reports a dynamic process context parameter to Jeyzerabstract void
setNodeName(java.lang.String nodeName)
Set the process or node name.abstract void
setProcessBuildNumber(java.lang.String buildNumber)
Set the process build number if any.abstract void
setProcessName(java.lang.String name)
Set the process name.abstract void
setProcessVersion(java.lang.String version)
Set the process version.abstract void
setProfileName(java.lang.String profile)
Set the Jeyzer applicative profile name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jeyzer.mx.JeyzerMXBean
consumeEvents, consumePublisherEvents, getDynamicProcessContextParams, getEvents, getNodeName, getProcessBuildNumber, getProcessName, getProcessVersion, getProfileName, getPublisherEvents, getStaticProcessContextParams, getThreadInfoList, isActive, isDataCollectionActive, isEventCollectionActive, resumeDataCollection, resumeEventCollection, suspendDataCollection, suspendEventCollection
-
-
-
-
Method Detail
-
instance
public static JeyzerPublisher instance()
Gets the Jeyzer Publisher unique instance- Returns:
- the Jeyzer publisher instance
-
init
public abstract boolean init(java.util.Properties props)
Initialize the Jeyzer publisher. Optional. Supported properties are listed inJeyzerPublisherInit
- Parameters:
props
- the initialization properties- Returns:
- true if the initialization occurred
-
setProfileName
public abstract void setProfileName(java.lang.String profile)
Set the Jeyzer applicative profile name.- Parameters:
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.- Parameters:
nodeName
- the node name
-
setProcessName
public abstract void setProcessName(java.lang.String name)
Set the process name.- Parameters:
name
- the process name
-
setProcessVersion
public abstract void setProcessVersion(java.lang.String version)
Set the process version.- Parameters:
version
- the process version
-
setProcessBuildNumber
public abstract void setProcessBuildNumber(java.lang.String buildNumber)
Set the process build number if any.- Parameters:
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.- Parameters:
key
- the static process context parameter keyvalue
- 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- Parameters:
key
- the dynamic process context parameter keyvalue
- the dynamic process context parameter value
-
removeDynamicProcessContextParam
public abstract void removeDynamicProcessContextParam(java.lang.String key)
Removes a dynamic process context parameter to Jeyzer- Parameters:
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- Parameters:
source
- the applicative source. Nullable. By default the process name if available.service
- the dynamic process context parameter value. Can be null- Returns:
- the Jeyzer monitor handler
-
getActionHandler
public abstract JzrActionHandler getActionHandler()
Get a Jeyzer action handler- Returns:
- 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 interfaceJeyzerMXBean
- Returns:
- the Jeyzer publish library version
-
-