org.springframework.batch.admin.jmx
Class StepExecutionServiceLevelMonitor

java.lang.Object
  extended by org.springframework.batch.admin.jmx.StepExecutionServiceLevelMonitor
All Implemented Interfaces:
FactoryBean<GaugeMonitor>, InitializingBean

public class StepExecutionServiceLevelMonitor
extends Object
implements FactoryBean<GaugeMonitor>, InitializingBean

Monitors executions of a given step and sends JMX notifications if it takes too long. The monitor is a MonitorMBean so it can be automatically exposed to an existing MBeanServer using Spring JMX. JMX clients subscribe to notifications and receive them whenever the thresholds are crossed.

Author:
Dave Syer

Constructor Summary
StepExecutionServiceLevelMonitor()
           
 
Method Summary
 void afterPropertiesSet()
           
 GaugeMonitor getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setAutoStart(boolean autoStart)
          Should the monitor start immediately or wait to be started manually?
 void setDefaultDomain(String defaultDomain)
          The domain name to use in constructing object names for the monitored step.
 void setJobName(String jobName)
           
 void setLowerThreshold(int lowerThreshold)
          Optional lower threshold.
 void setObservedAttribute(String observedAttribute)
          The name of the attribute to monitor on the step.
 void setStepName(String stepName)
           
 void setUpperThreshold(int upperThreshold)
          Upper threshold for observed attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StepExecutionServiceLevelMonitor

public StepExecutionServiceLevelMonitor()
Method Detail

setObservedAttribute

public void setObservedAttribute(String observedAttribute)
The name of the attribute to monitor on the step. Defaults to LatestDuration. This can be changed at runtime, but note that if the type of the observed metric changes (e.g. from double to integer) then the thresholds will also have to be changed so their type matches.

Parameters:
observedAttribute - the observed attribute to set

setAutoStart

public void setAutoStart(boolean autoStart)
Should the monitor start immediately or wait to be started manually?

Parameters:
autoStart - the auto start flag to set

setDefaultDomain

public void setDefaultDomain(String defaultDomain)
The domain name to use in constructing object names for the monitored step. Default to org.springframework.batch (same as BatchMBeanExporter).

Parameters:
defaultDomain - the default domain to set

setStepName

public void setStepName(String stepName)
Parameters:
stepName - the stepName to set

setJobName

public void setJobName(String jobName)
Parameters:
jobName - the jobName to set

setUpperThreshold

public void setUpperThreshold(int upperThreshold)
Upper threshold for observed attribute. Mandatory with no default.

Parameters:
upperThreshold - the upper threshold to set

setLowerThreshold

public void setLowerThreshold(int lowerThreshold)
Optional lower threshold. Defaults to 80% of the upper threshold.

Parameters:
lowerThreshold - the lower threshold to set

getObject

public GaugeMonitor getObject()
                       throws Exception
Specified by:
getObject in interface FactoryBean<GaugeMonitor>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean<GaugeMonitor>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<GaugeMonitor>

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception


Copyright © 2011. All Rights Reserved.