Class History

java.lang.Object
org.jolokia.service.history.History
All Implemented Interfaces:
HistoryMBean

public class History extends Object implements HistoryMBean
MBean for exporting various configuration tuning opportunities to the outside world.
Since:
Jun 12, 2009
Author:
roland
  • Constructor Details

    • History

      public History(HistoryStore pStore)
      Constructor with the configurable objects as parameters.
      Parameters:
      pStore - history store where to hold historical values
  • Method Details

    • updateAndAdd

      public void updateAndAdd(org.jolokia.server.core.request.JolokiaRequest pJmxReq, org.jolokia.json.JSONObject pJson)
      Update the history store with the value of an an read, write or execute operation. Also, the timestamp of the insertion is recorded. Also, the recorded history values are added to the given json value. This operation must be called only internally.
      Specified by:
      updateAndAdd in interface HistoryMBean
      Parameters:
      pJmxReq - request for which an entry should be added in this history store
      pJson - the JSONObject to which to add the history.
    • setHistoryEntriesForAttribute

      public void setHistoryEntriesForAttribute(String pMBean, String pAttribute, String pPath, String pTarget, int pMaxEntries) throws MalformedObjectNameException
      Switch on history tracking for a specific attribute. If pMaxEntries is 0 history tracking is switched off.
      Specified by:
      setHistoryEntriesForAttribute in interface HistoryMBean
      Parameters:
      pMBean - MBean object name
      pAttribute - attribute name
      pPath - inner path (optional)
      pTarget - remote target or null for a local mbean
      pMaxEntries - max last entries to remember, if 0 history tracking is switched off.
      Throws:
      MalformedObjectNameException - if the given name is not proper object name
    • setHistoryLimitForAttribute

      public void setHistoryLimitForAttribute(String pMBean, String pAttribute, String pPath, String pTarget, int pMaxEntries, long pMaxDuration) throws MalformedObjectNameException
      Switch on history tracking for a specific attribute. If pMaxEntries and pMaxDuration is 0 then history tracking is switched off. If either pMaxEntries or pMaxDuration 0, then the given limit applies. If both are != 0, then both limits are applied simultaneously.
      Specified by:
      setHistoryLimitForAttribute in interface HistoryMBean
      Parameters:
      pMBean - MBean object name
      pAttribute - attribute name
      pPath - inner path (optional)
      pTarget - remote target or null for a local mbean
      pMaxEntries - max last entries to remember, if 0 history tracking is switched off.
      pMaxDuration - maximum duration the maximum duration for how long to keep a value (in seconds)
      Throws:
      MalformedObjectNameException - if the given name is not proper object name
    • setHistoryEntriesForOperation

      public void setHistoryEntriesForOperation(String pMBean, String pOperation, String pTarget, int pMaxEntries) throws MalformedObjectNameException
      Switch on history tracking for an operation. If pMaxEntries is 0 history tracking is switched off. The return value of the operation will be tracked.
      Specified by:
      setHistoryEntriesForOperation in interface HistoryMBean
      Parameters:
      pMBean - MBean object name
      pOperation - operation to track
      pTarget - remote target or null for a loal mbean
      pMaxEntries - max last entries to remember, if 0 history tracking is switched off.
      Throws:
      MalformedObjectNameException
    • setHistoryLimitForOperation

      public void setHistoryLimitForOperation(String pMBean, String pOperation, String pTarget, int pMaxEntries, long pMaxDuration) throws MalformedObjectNameException
      Switch on history tracking for an operation. If pMaxEntries and pMaxDuration is 0 history tracking is switched off. The return value of the operation will be tracked. If either pMaxEntries or pMaxDuration 0, then the given limit applies. If both are != 0, then both limits are applied simultaneously.
      Specified by:
      setHistoryLimitForOperation in interface HistoryMBean
      Parameters:
      pMBean - MBean object name
      pOperation - operation to track
      pTarget - remote target or null for a loal mbean
      pMaxEntries - max last entries to remember, if 0 history tracking is switched off.
      pMaxDuration - maximum duration the maximum duration for how long to keep a value (in seconds)
      Throws:
      MalformedObjectNameException
    • resetHistoryEntries

      public void resetHistoryEntries()
      Remove all history entries and switch off history tracking globally.
      Specified by:
      resetHistoryEntries in interface HistoryMBean
    • getHistoryMaxEntries

      public int getHistoryMaxEntries()
      Number of global limit for history entries. No attribute historization can exceed this limit (i.e if in HistoryMBean.setHistoryLimitForAttribute(String, String, String, String, int, long) the pMaxEntries is set larger than this limit, the global limit will be taken}
      Specified by:
      getHistoryMaxEntries in interface HistoryMBean
      Returns:
      the global history limit
    • setHistoryMaxEntries

      public void setHistoryMaxEntries(int pLimit)
      Set the global history limit
      Specified by:
      setHistoryMaxEntries in interface HistoryMBean
      Parameters:
      pLimit - limit to set
    • getHistorySize

      public int getHistorySize()
      Get the size in bytes which the history mechanism requires in total if serialized.
      Specified by:
      getHistorySize in interface HistoryMBean
      Returns:
      size of the complete history in bytes