public final class MonitoringController extends AbstractController implements IMonitoringController, IStateListener
monitoringController| Modifier and Type | Method and Description |
|---|---|
boolean |
activateProbe(java.lang.String pattern)
Activates a probe.
|
void |
beforeEnableMonitoring()
Triggers if the monitoring is guaranteed to be enabled, but has not yet been published to other threads.
|
protected void |
cleanup()
This method should clean up.
|
static MonitoringController |
createInstance(Configuration configuration)
This is a factory method creating a new monitoring controller instance using the given configuration.
|
boolean |
deactivateProbe(java.lang.String pattern)
Deactivates a probe.
|
boolean |
disableMonitoring()
Disables monitoring.
|
boolean |
enableMonitoring()
Enables monitoring.
|
int |
getExperimentId() |
java.lang.String |
getHostname()
The hostname will be part of the monitoring data and allows to distinguish observations in cases where the software system is deployed on more than one host.
|
static IMonitoringController |
getInstance() |
java.lang.String |
getJMXDomain() |
java.lang.String |
getName()
Returns the name of this controller.
|
java.util.List<java.lang.String> |
getProbePatternList()
Returns the current list of patterns with a prefix indicating whether the pattern is active or not.
|
protected SamplingController |
getSamplingController() |
ITimeSource |
getTimeSource()
Returns the ITimeSource used in this controller.
|
static java.lang.String |
getVersion()
Return the version name of this controller instance.
|
int |
incExperimentId()
Increments the experiment ID by 1 and returns the new value.
|
protected void |
init()
This method should to the initialization work.
|
boolean |
isDebug()
Is the debug mode enabled?
|
boolean |
isMonitoringEnabled()
Returns whether monitoring is enabled or disabled/terminated.
|
boolean |
isMonitoringTerminated()
Returns whether monitoring is permanently terminated.
|
boolean |
isProbeActivated(java.lang.String signature)
Tests if a probe is active.
|
boolean |
newMonitoringRecord(IMonitoringRecord record)
Called for each new record to write it out to the pre-configured target (e.g., file system, database, or messaging queue).
|
boolean |
removeScheduledSampler(ScheduledSamplerJob sampler)
Stops future executions of the given periodic
ScheduledSamplerJob . |
ScheduledSamplerJob |
schedulePeriodicSampler(ISampler sampler,
long initialDelay,
long period,
java.util.concurrent.TimeUnit timeUnit)
Schedules the given
ISampler with given initial delay, and period. |
boolean |
sendMetadataAsRecord()
This method sends the meta data (like the controller and host name, the experiment ID, etc.) as a record.
|
void |
setExperimentId(int newExperimentID)
Sets the experiment ID to the given value.
|
void |
setProbePatternList(java.util.List<java.lang.String> patternList)
Overwrites the current list of patterns with a new pattern list.
|
boolean |
terminateMonitoring()
Permanently terminates monitoring.
|
java.lang.String |
toString()
This method is used to log the status of the controllers to the console.
|
void |
waitForTermination(long timeoutInMs)
Waits for the termination of the monitoring controller.
|
createAndInitialize, isTerminated, setMonitoringController, terminatepublic static final MonitoringController createInstance(Configuration configuration)
configuration - The configuration for the new controller.public static final java.lang.String getVersion()
public void beforeEnableMonitoring()
IStateListenerbeforeEnableMonitoring in interface IStateListenerprotected final void init()
AbstractControllerinit in class AbstractControllerprotected final void cleanup()
AbstractControllercleanup in class AbstractControllerpublic final java.lang.String toString()
IMonitoringControllertoString in interface IMonitoringControllertoString in class AbstractControllerpublic final boolean sendMetadataAsRecord()
sendMetadataAsRecord in interface IMonitoringControllerprotected SamplingController getSamplingController()
public final boolean terminateMonitoring()
IStateControllerterminateMonitoring in interface IStateControllerIStateController.isMonitoringTerminated()public final boolean isMonitoringTerminated()
IStateControllerisMonitoringTerminated in interface IStateControllerIStateController.terminateMonitoring()public final boolean enableMonitoring()
IStateControllerenableMonitoring in interface IStateControllerpublic final boolean disableMonitoring()
IStateControllerdisableMonitoring in interface IStateControllerpublic final boolean isMonitoringEnabled()
IStateControllerisMonitoringEnabled in interface IStateControllerIStateController.disableMonitoring(),
IStateController.enableMonitoring()public final boolean isDebug()
IStateControllerDebug mode is for internal use only and changes a few internal id generation mechanisms to enable easier debugging. Additionally, it is possible to enable debug logging in the settings of the used logger.
isDebug in interface IStateControllerpublic final java.lang.String getName()
IStateControllergetName in interface IStateControllerpublic final java.lang.String getHostname()
IStateControllergetHostname in interface IStateControllerpublic final int incExperimentId()
IStateControllerincExperimentId in interface IStateControllerpublic final void setExperimentId(int newExperimentID)
IStateControllersetExperimentId in interface IStateControllernewExperimentID - The new ID.public final int getExperimentId()
getExperimentId in interface IStateControllerpublic final boolean newMonitoringRecord(IMonitoringRecord record)
IWriterController
Called for each new record to write it out to the pre-configured target (e.g., file system, database, or messaging queue). This method could invoke the given
record's methods declared in IMonitoringRecord and thus alter its loggingTimestamp property.
Notice, that this method should not throw an exception, but indicate an error by the return value false.
newMonitoringRecord in interface IMonitoringRecordReceivernewMonitoringRecord in interface IWriterControllerrecord - the record.public void waitForTermination(long timeoutInMs)
throws java.lang.InterruptedException
IWriterControllerterminateMonitoring().waitForTermination in interface IWriterControllertimeoutInMs - timeout in milliseconds to wait (a timeout of 0 means to wait forever)java.lang.InterruptedException - if the calling thread was interrupted while waiting for the terminationpublic final ScheduledSamplerJob schedulePeriodicSampler(ISampler sampler, long initialDelay, long period, java.util.concurrent.TimeUnit timeUnit)
ISamplingControllerISampler with given initial delay, and period.schedulePeriodicSampler in interface ISamplingControllersampler - The sampler to schedule.initialDelay - The initial delay.period - The period.timeUnit - The time unit which determines how to interpret the given parameter.ScheduledSamplerJob as a handler for removing the scheduled sampler later on by using the method
ISamplingController.removeScheduledSampler(ScheduledSamplerJob).public final boolean removeScheduledSampler(ScheduledSamplerJob sampler)
ISamplingControllerScheduledSamplerJob .removeScheduledSampler in interface ISamplingControllersampler - The sampler to be removed.public final ITimeSource getTimeSource()
ITimeSourceControllergetTimeSource in interface ITimeSourceControllerpublic final java.lang.String getJMXDomain()
getJMXDomain in interface IJMXControllerpublic final boolean activateProbe(java.lang.String pattern)
IProbeControlleractivateProbe in interface IProbeControllerpattern - pattern for the probepublic final boolean deactivateProbe(java.lang.String pattern)
IProbeControllerdeactivateProbe in interface IProbeControllerpattern - pattern for the probepublic boolean isProbeActivated(java.lang.String signature)
IProbeControllerisProbeActivated in interface IProbeControllersignature - signature of the probepublic void setProbePatternList(java.util.List<java.lang.String> patternList)
IProbeControllersetProbePatternList in interface IProbeControllerpatternList - list of strings with patterns where each string starts either with a + or -. The list can be empty (in which case the internal pattern list and the
internal cache are cleared) - but not null.public java.util.List<java.lang.String> getProbePatternList()
IProbeControllergetProbePatternList in interface IProbeControllerpublic static final IMonitoringController getInstance()
Copyright 2017 Kieker Project, http://kieker-monitoring.net