An atg.service.statistics.Sampler
is configured with a list of service name/property name pairs, naming the properties to be sampled. From this list, the Sampler
can generate a SampleEvent
containing the current values of those properties. The method sample()
generates such a SampleEvent
.
A Sampler
can also have one or more atg.service.statistics.SampleListener
objects added to it. When a Sample
is taken, the sample can be broadcast to all SampleListener
objects by calling acceptSample()
on those listeners. Calling sample(true)
both generates a new SampleEvent
and broadcasts that event to all listeners.
A Sampler
can also be configured with a Scheduler
and Schedule
. If so, the Sampler
automatically calls sample(true)
according to the specified Schedule
.
In summary, the Sampler
can be used in the following ways:
Call
sample()
to obtain samples manually.Attach
SampleListeners
and callsample(true)
to broadcast samples manually.Attach
SampleListeners
and specify aScheduler
andScheduler
to broadcast samples automatically.