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, terminate
public static final MonitoringController createInstance(Configuration configuration)
configuration
- The configuration for the new controller.public static final java.lang.String getVersion()
public void beforeEnableMonitoring()
IStateListener
beforeEnableMonitoring
in interface IStateListener
protected final void init()
AbstractController
init
in class AbstractController
protected final void cleanup()
AbstractController
cleanup
in class AbstractController
public final java.lang.String toString()
IMonitoringController
toString
in interface IMonitoringController
toString
in class AbstractController
public final boolean sendMetadataAsRecord()
sendMetadataAsRecord
in interface IMonitoringController
protected SamplingController getSamplingController()
public final boolean terminateMonitoring()
IStateController
terminateMonitoring
in interface IStateController
IStateController.isMonitoringTerminated()
public final boolean isMonitoringTerminated()
IStateController
isMonitoringTerminated
in interface IStateController
IStateController.terminateMonitoring()
public final boolean enableMonitoring()
IStateController
enableMonitoring
in interface IStateController
public final boolean disableMonitoring()
IStateController
disableMonitoring
in interface IStateController
public final boolean isMonitoringEnabled()
IStateController
isMonitoringEnabled
in interface IStateController
IStateController.disableMonitoring()
,
IStateController.enableMonitoring()
public final boolean isDebug()
IStateController
Debug 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 IStateController
public final java.lang.String getName()
IStateController
getName
in interface IStateController
public final java.lang.String getHostname()
IStateController
getHostname
in interface IStateController
public final int incExperimentId()
IStateController
incExperimentId
in interface IStateController
public final void setExperimentId(int newExperimentID)
IStateController
setExperimentId
in interface IStateController
newExperimentID
- The new ID.public final int getExperimentId()
getExperimentId
in interface IStateController
public 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 IMonitoringRecordReceiver
newMonitoringRecord
in interface IWriterController
record
- the record.public void waitForTermination(long timeoutInMs) throws java.lang.InterruptedException
IWriterController
terminateMonitoring()
.waitForTermination
in interface IWriterController
timeoutInMs
- 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)
ISamplingController
ISampler
with given initial delay, and period.schedulePeriodicSampler
in interface ISamplingController
sampler
- 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)
ISamplingController
ScheduledSamplerJob
.removeScheduledSampler
in interface ISamplingController
sampler
- The sampler to be removed.public final ITimeSource getTimeSource()
ITimeSourceController
getTimeSource
in interface ITimeSourceController
public final java.lang.String getJMXDomain()
getJMXDomain
in interface IJMXController
public final boolean activateProbe(java.lang.String pattern)
IProbeController
activateProbe
in interface IProbeController
pattern
- pattern for the probepublic final boolean deactivateProbe(java.lang.String pattern)
IProbeController
deactivateProbe
in interface IProbeController
pattern
- pattern for the probepublic boolean isProbeActivated(java.lang.String signature)
IProbeController
isProbeActivated
in interface IProbeController
signature
- signature of the probepublic void setProbePatternList(java.util.List<java.lang.String> patternList)
IProbeController
setProbePatternList
in interface IProbeController
patternList
- 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()
IProbeController
getProbePatternList
in interface IProbeController
public static final IMonitoringController getInstance()
Copyright 2017 Kieker Project, http://kieker-monitoring.net