org.ow2.jasmine.probe.collectors.df.internal
Class DfCollector

java.lang.Object
  extended by org.ow2.jasmine.probe.collectors.JCollector
      extended by org.ow2.jasmine.probe.collectors.df.internal.DfCollector
All Implemented Interfaces:
org.ow2.jasmine.probe.collector.JasmineCollector

public class DfCollector
extends org.ow2.jasmine.probe.collectors.JCollector

Collector implementation for df. This implementation works with a separate thread used to pre collect the results. A simpler implementation could be done by not using a thread. Using a thread is interesting when we do not want to be stuck in case info cannot be got.

Author:
durieuxp

Field Summary
 
Fields inherited from class org.ow2.jasmine.probe.collectors.JCollector
indicator, logger, name, period
 
Constructor Summary
DfCollector(java.lang.String name, org.ow2.jasmine.probe.JasmineIndicator indicator, int period)
          Constructor
 
Method Summary
 void addResult(org.ow2.jasmine.probe.JasmineIndicatorValue value)
          Add a new result to the list.
 java.util.Collection<java.lang.String> getDiskList()
          Get the disk to be observed null if we are interested on all disks
 org.ow2.jasmine.probe.JasmineIndicatorValue getLastResult()
          Retrieve the last results for this indicator This method return a List of results in case indicator represents actually a list of value (for example: df for ALL the disks)
 boolean needResult()
          Check if this Collector needs a new result.
 void startPolling()
          Restart polling
 void stopPolling()
          Stop polling
 
Methods inherited from class org.ow2.jasmine.probe.collectors.JCollector
addValues, diffValues, divideValues, getIndicator, getName, longValue, multiplyValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DfCollector

public DfCollector(java.lang.String name,
                   org.ow2.jasmine.probe.JasmineIndicator indicator,
                   int period)
Constructor

Parameters:
indicator - definition
Method Detail

getDiskList

public java.util.Collection<java.lang.String> getDiskList()
Get the disk to be observed null if we are interested on all disks

Returns:

getLastResult

public org.ow2.jasmine.probe.JasmineIndicatorValue getLastResult()
                                                          throws org.ow2.jasmine.probe.collector.JasmineCollectorException
Retrieve the last results for this indicator This method return a List of results in case indicator represents actually a list of value (for example: df for ALL the disks)

Specified by:
getLastResult in interface org.ow2.jasmine.probe.collector.JasmineCollector
Specified by:
getLastResult in class org.ow2.jasmine.probe.collectors.JCollector
Returns:
List of JasmineIndicatorValue
Throws:
org.ow2.jasmine.probe.collector.JasmineCollectorException

stopPolling

public void stopPolling()
Stop polling

Specified by:
stopPolling in interface org.ow2.jasmine.probe.collector.JasmineCollector
Specified by:
stopPolling in class org.ow2.jasmine.probe.collectors.JCollector

startPolling

public void startPolling()
Restart polling

Specified by:
startPolling in interface org.ow2.jasmine.probe.collector.JasmineCollector
Specified by:
startPolling in class org.ow2.jasmine.probe.collectors.JCollector

needResult

public boolean needResult()
Check if this Collector needs a new result. A stopped collector returns false. Otherwise, it returns true if the cache is empty or outdated regarding to the poll period and the OBSOLATE_TIME constant.

Returns:
true if it needs one

addResult

public void addResult(org.ow2.jasmine.probe.JasmineIndicatorValue value)
Add a new result to the list.

Parameters:
value -


Copyright © 2011 OW2 Consortium. All Rights Reserved.