|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@StableMinor(version="6.2", sinceVersion="4.1") public interface IMonitorContext
Stores contextual data and configuration for use by the monitoring framework and by the logging framework. The state of the monitor context applies to the current thread.
IMonitorManager
Method Summary | |
---|---|
void |
clear()
Clears all data stored in the current monitor context and resets it to default state. |
Map<String,String> |
getAggregationValueMap()
Returns a view of aggregation values stored in this monitor context. |
boolean |
isEnabled()
Returns true if monitoring is enabled in the current monitoring context. |
void |
removeAggregationValue(String aggregationTypeKey)
Removes an aggregation value from the current monitor context and from current log context. |
void |
setAggregationValue(String aggregationTypeKey,
String value)
Stores an aggregation value in this monitor context and in current log context. |
void |
setEnabled(boolean enabled)
Enables or disables the monitoring in the current monitoring context. |
Method Detail |
---|
Map<String,String> getAggregationValueMap()
There is no garantee whether the returned map will or will not reflect futher changes made in this monitor context.
void setAggregationValue(String aggregationTypeKey, String value)
MDC.put(String, Object)
to add
the aggregation value in current log context.
removeAggregationValue(String)
should be called (use a
try/finally block to ensure that) to remove the aggregation value set
when it should no longer be applied.
Typical use for setting an aggregation value follows below:
final String aggregationTypeKey = ...; final String aggregationValue = ...; monitorContext.setAggregationValue(aggregationTypeKey, aggregationValue); try { // execution block that will have the set aggregation value as default } finally { monitorContext.removeAggregationValue(aggregationTypeKey); }
aggregationTypeKey
- the aggregation type's key.value
- the value to set for the aggregation type.void removeAggregationValue(String aggregationTypeKey)
MDC.remove(String)
must be called by
implementations to remove an aggregation value from current log context.
aggregationTypeKey
- setAggregationValue(String, String)
void clear()
#clear()
to clear current log context.
boolean isEnabled()
setEnabled(boolean)
void setEnabled(boolean enabled)
IMonitor
instances returned by
IMonitorManager.getMonitor(String, java.util.Map)
will
be monitor instances that do not collect any measure.
enabled
- true to enable or false to disable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |