|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.nucleus.TimedOperationService
atg.service.statistics.Sampler
public class Sampler
A Sampler is the base class for services that wish to keep a list of statistics about other services. The sampler is configured with a list of properties to be sampled. Each property is specified in the form {service name}.{property name}.The list is assigned to the property "sampleSources". For example:
sampleSources=\ /servers/HttpServer.handledRequestCount,\ /requesthandling/FileCache.cacheHitRatio
On demand, the Sampler can sample all of the properties in the list and produce a SampleEvent, which contains the samples in the order they were specified.
The Sampler can also send out a SampleEvent as an event to all SampleListeners. This can happen on demand as well.
Finally, if Scheduler and Schedule properties are defined, then this Sampler will send out events to SampleListeners according to the given Schedule.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected atg.service.statistics.Sampler.SampleSource[] |
mSources
The sample sources |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
Sampler()
Constructs a blank new Sampler |
Method Summary | |
---|---|
void |
addSampleListener(SampleListener pListener)
Adds a listener to the list of listeners to be notified when a new sample is taken. |
void |
doStartService()
This will start the thread running |
void |
doStopService()
This will stop the scheduler thread |
protected Sample |
getSample(atg.service.statistics.Sampler.SampleSource pSource,
Sample pPreviousSample)
Obtains a sample from the given source |
int |
getSampleListenerCount()
Returns the number of sample listeners |
SampleListener[] |
getSampleListeners()
Returns an array of the sample listeners |
java.lang.String[] |
getSampleSources()
Returns the list of {service}.{property} values to be included in every sample. |
Schedule |
getSchedule()
Returns the Schedule on which this sampler will run. |
Scheduler |
getScheduler()
Returns the Scheduler that will run this sampler |
void |
initSources()
Initializes the array of sources to be sampled from the SampleSources property |
void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
Obtains a sample and sends it to the listeners |
void |
removeSampleListener(SampleListener pListener)
Removes a listener from the list of listeners to be notified when a new sample is taken. |
SampleEvent |
sample()
Performs a sample on all of the sources in the sample list and returns the result without notifying the listeners. |
SampleEvent |
sample(boolean pNotifyListeners)
Performs a sample on all of the sources in the sample list and returns the result. |
void |
setSampleSources(java.lang.String[] pSampleSources)
Sets the list of {service}.{property} values to be included in every sample. |
void |
setSchedule(Schedule pSchedule)
Sets the Schedule on which this sampler will run. |
void |
setScheduler(Scheduler pScheduler)
Sets the Scheduler that will run this sampler |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
protected atg.service.statistics.Sampler.SampleSource[] mSources
Constructor Detail |
---|
public Sampler()
Method Detail |
---|
public SampleEvent sample(boolean pNotifyListeners) throws ServiceException
pNotifyListeners
- if true, then all SampleListeners will
also be notified.
ServiceException
- if an error occurred while obtaining a
sample.public SampleEvent sample() throws ServiceException
ServiceException
- if an error occurred while obtaining a
sample.protected Sample getSample(atg.service.statistics.Sampler.SampleSource pSource, Sample pPreviousSample) throws ServiceException
ServiceException
- if an error occurred while obtaining the
sample.public void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- calling the jobpJob
- the ScheduledJobpublic void setSampleSources(java.lang.String[] pSampleSources)
public java.lang.String[] getSampleSources()
public void setScheduler(Scheduler pScheduler)
public Scheduler getScheduler()
public void setSchedule(Schedule pSchedule)
public Schedule getSchedule()
public void addSampleListener(SampleListener pListener)
public void removeSampleListener(SampleListener pListener)
public int getSampleListenerCount()
public SampleListener[] getSampleListeners()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void initSources() throws ServiceException
ServiceException
public void doStopService()
doStopService
in class GenericService
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |