lumis.portal.monitor
Interface IMonitorContext

Package class diagram package IMonitorContext

@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.

Since:
4.1.0
See Also:
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

getAggregationValueMap

Map<String,String> getAggregationValueMap()
Returns a view of aggregation values stored in this monitor context.

There is no garantee whether the returned map will or will not reflect futher changes made in this monitor context.

Returns:
an immutable map where the key is the aggregation type key and the value is its respective value in this monitor context.
Since:
4.1.0

setAggregationValue

void setAggregationValue(String aggregationTypeKey,
                         String value)
Stores an aggregation value in this monitor context and in current log context. Implementation must call 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);
 }
 

Parameters:
aggregationTypeKey - the aggregation type's key.
value - the value to set for the aggregation type.
Since:
4.1.0

removeAggregationValue

void removeAggregationValue(String aggregationTypeKey)
Removes an aggregation value from the current monitor context and from current log context. MDC.remove(String) must be called by implementations to remove an aggregation value from current log context.

Parameters:
aggregationTypeKey -
Since:
4.1.0
See Also:
setAggregationValue(String, String)

clear

void clear()
Clears all data stored in the current monitor context and resets it to default state. Implementations must call #clear() to clear current log context.

Since:
4.1.0

isEnabled

boolean isEnabled()
Returns true if monitoring is enabled in the current monitoring context.

Returns:
true if enabled, false if disabled.
Since:
4.1.0
See Also:
setEnabled(boolean)

setEnabled

void setEnabled(boolean enabled)
Enables or disables the monitoring in the current monitoring context. While disabled, all IMonitor instances returned by IMonitorManager.getMonitor(String, java.util.Map) will be monitor instances that do not collect any measure.

Parameters:
enabled - true to enable or false to disable.
Since:
4.1.0


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.