org.ow2.jasmine.probe.collectors.jmx.internal
Class JmxCollector

java.lang.Object
  extended by org.ow2.jasmine.probe.collectors.JCollector
      extended by org.ow2.jasmine.probe.collectors.jmx.internal.JmxCollector
All Implemented Interfaces:
JasmineCollector

public class JmxCollector
extends JCollector

Collector implementation for JMX. This implementation works with a separate thread used to pre-collect the results. Using a thread is interesting when we do not want to be stuck in case info cannot be got because the target is off.

Author:
durieuxp

Field Summary
 
Fields inherited from class org.ow2.jasmine.probe.collectors.JCollector
hostName, indicator, logger, period, probeId, probeManager
 
Constructor Summary
JmxCollector(String probeId, JasmineIndicator indicator, int period, String mbean, String csv)
          Constructor
 
Method Summary
 void addResult(List<Metric> metrics)
          Add a new result to the list.
 Collection<String> getAttrlist()
          Getter for attrlist (list of provided attribute and or fragment names).
 JasmineIndicatorValue getLastResult()
          Retrieve the last results for this indicator This method return a List of results in case indicator represents actually a list of values.
 ObjectName getObjectName()
           
protected  boolean hasAttributes()
          Allows the JmxWorker to know if attributes and/or fragments are provided by the indicator definition.
 boolean needResult()
          Check if this Collector needs a new result.
 void startPolling()
          Start polling
 void stopPolling()
          Stop polling
 
Methods inherited from class org.ow2.jasmine.probe.collectors.JCollector
addJsr, addLongJsr, addLongValues, addValues, averageJsr, diffJsr, diffLongValues, diffValues, divideJsr, divideLongValues, divideValues, getDomainName, getIndicator, getIndicatorName, getProbeId, getServerName, isRemoved, jsrProps, longValue, maxJsr, minJsr, multiplyJsr, multiplyLongValues, multiplyValues, remove, setProbeManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxCollector

public JmxCollector(String probeId,
                    JasmineIndicator indicator,
                    int period,
                    String mbean,
                    String csv)
Constructor

Parameters:
probeId - probe Identifier
indicator - JasmineIndicator definition
period - in seconds
mbean - MBean pattern
csv - CSV list of attributes
Method Detail

getAttrlist

public Collection<String> getAttrlist()
Getter for attrlist (list of provided attribute and or fragment names).

Returns:
return the provided attribute and or fragment names.

getObjectName

public ObjectName getObjectName()
                         throws JasmineCollectorException
Returns:
The ObjectName instance corresponding to the mbean pattern provided in the indicator definition.
Throws:
JasmineCollectorException - an ObjectName could not be obtained as the pattern in not well formed given the JMX naming conventions.

hasAttributes

protected boolean hasAttributes()
Allows the JmxWorker to know if attributes and/or fragments are provided by the indicator definition.

Returns:
true if attributes and or fragments are provided by the indicator definition.

getLastResult

public JasmineIndicatorValue getLastResult()
                                    throws JasmineCollectorException
Retrieve the last results for this indicator This method return a List of results in case indicator represents actually a list of values.

Specified by:
getLastResult in interface JasmineCollector
Specified by:
getLastResult in class JCollector
Returns:
The constructed JasmineIndicatorValue
Throws:
JasmineCollectorException

stopPolling

public void stopPolling()
Stop polling

Specified by:
stopPolling in interface JasmineCollector
Specified by:
stopPolling in class JCollector

startPolling

public void startPolling()
Start polling

Specified by:
startPolling in interface JasmineCollector
Specified by:
startPolling in class JCollector

needResult

public boolean needResult()
Check if this Collector needs a new result. A stopped collector returns false. Otherwise, it returns true if there are nor metrics, or if metrics are out-dated regarding to the poll period.

Returns:
true if it needs one

addResult

public void addResult(List<Metric> metrics)
Add a new result to the list.

Parameters:
metrics -


Copyright © 2012 OW2 Consortium. All Rights Reserved.