sk.baka.webvm.analyzer
Class HistorySampler

java.lang.Object
  extended by sk.baka.webvm.misc.BackgroundService
      extended by sk.baka.webvm.analyzer.HistorySampler

public final class HistorySampler
extends BackgroundService

Samples the VM history regularly. You need to invoke BackgroundService.start() to start the sampler, BackgroundService.stop() to stop it. Thread-safe.

Author:
Martin Vysny

Field Summary
static SamplerConfig HISTORY_PROBLEMS
          Default Problems history.
static SamplerConfig HISTORY_VMSTAT
          Default VMStat history.
 
Fields inherited from class sk.baka.webvm.misc.BackgroundService
maxThreads, name
 
Constructor Summary
HistorySampler(ProblemAnalyzer analyzer)
          Creates new sampler instance with default values.
HistorySampler(SamplerConfig vmstatConfig, SamplerConfig problemConfig, ProblemAnalyzer analyzer)
          Creates new sampler instance.
 
Method Summary
 void configure(Config config)
          Sets the new configuration file.
 List<List<ProblemReport>> getProblemHistory()
          Returns a snapshot view over the problem history.
 List<HistorySample> getVmstatHistory()
          Returns a snapshot of the history values.
protected  void started(ScheduledExecutorService executor)
          Invoked when the service is started.
protected  void stopped()
          Invoked after the service has been stopped.
 
Methods inherited from class sk.baka.webvm.misc.BackgroundService
getExecutor, newDaemonFactory, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY_VMSTAT

public static final SamplerConfig HISTORY_VMSTAT
Default VMStat history.


HISTORY_PROBLEMS

public static final SamplerConfig HISTORY_PROBLEMS
Default Problems history.

Constructor Detail

HistorySampler

public HistorySampler(ProblemAnalyzer analyzer)
Creates new sampler instance with default values.

Parameters:
analyzer - a configured instance of the analyzer

HistorySampler

public HistorySampler(SamplerConfig vmstatConfig,
                      SamplerConfig problemConfig,
                      ProblemAnalyzer analyzer)
Creates new sampler instance.

Parameters:
vmstatConfig - the vmstat sampler config
problemConfig - the problem sampler config
analyzer - a configured instance of the analyzer
Method Detail

configure

public void configure(Config config)
Sets the new configuration file.

Parameters:
config - the new config file.

started

protected void started(ScheduledExecutorService executor)
Description copied from class: BackgroundService
Invoked when the service is started.

Specified by:
started in class BackgroundService
Parameters:
executor - executes tasks.

stopped

protected void stopped()
Description copied from class: BackgroundService
Invoked after the service has been stopped.

Specified by:
stopped in class BackgroundService

getVmstatHistory

public List<HistorySample> getVmstatHistory()
Returns a snapshot of the history values.

Returns:
modifiable snapshot.

getProblemHistory

public List<List<ProblemReport>> getProblemHistory()
Returns a snapshot view over the problem history.

Returns:
the history.


Copyright © 2010 Baka. All Rights Reserved.