Kieker 1.12

kieker.monitoring.core.controller
Class MonitoringController

java.lang.Object
  extended by kieker.monitoring.core.controller.AbstractController
      extended by kieker.monitoring.core.controller.MonitoringController
All Implemented Interfaces:
IMonitoringRecordReceiver, IJMXController, IMonitoringController, IProbeController, IRegistryController, ISamplingController, IStateController, ITimeSourceController, IWriterController

public final class MonitoringController
extends AbstractController
implements IMonitoringController

Since:
1.3
Author:
Jan Waller

Field Summary
 
Fields inherited from class kieker.monitoring.core.controller.AbstractController
monitoringController
 
Method Summary
 boolean activateProbe(java.lang.String pattern)
          Activates a probe.
protected  void cleanup()
          This method should clean up.
static IMonitoringController 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.
 long getNumberOfInserts()
          Shows how many inserts have been performed since last restart of the execution environment.
 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()
           
 java.lang.String getStringForUniqueId(int id)
          Gets a string for a unique id.
 IRegistry<java.lang.String> getStringRegistry()
          Gets the used IRegistry.
 ITimeSource getTimeSource()
          Returns the ITimeSource used in this controller.
 int getUniqueIdForString(java.lang.String string)
          Gets a unique id for a string.
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.
 
Methods inherited from class kieker.monitoring.core.controller.AbstractController
createAndInitialize, isTerminated, setMonitoringController, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createInstance

public static final IMonitoringController createInstance(Configuration configuration)
This is a factory method creating a new monitoring controller instance using the given configuration.

Parameters:
configuration - The configuration for the new controller.
Returns:
A new controller.

getVersion

public static final java.lang.String getVersion()
Return the version name of this controller instance.

Returns:
the version name

init

protected final void init()
Description copied from class: AbstractController
This method should to the initialization work.

Specified by:
init in class AbstractController

cleanup

protected final void cleanup()
Description copied from class: AbstractController
This method should clean up.

Specified by:
cleanup in class AbstractController

toString

public final java.lang.String toString()
Description copied from interface: IMonitoringController
This method is used to log the status of the controllers to the console. It is included in this interface to ensure its publication over JMX.

Specified by:
toString in interface IMonitoringController
Specified by:
toString in class AbstractController
Returns:
a String representation of the current controller

sendMetadataAsRecord

public final boolean sendMetadataAsRecord()
This method sends the meta data (like the controller and host name, the experiment ID, etc.) as a record.

Specified by:
sendMetadataAsRecord in interface IMonitoringController
Returns:
true on success; false in case of an error.

getSamplingController

protected SamplingController getSamplingController()

terminateMonitoring

public final boolean terminateMonitoring()
Description copied from interface: IStateController
Permanently terminates monitoring.

Specified by:
terminateMonitoring in interface IStateController
Returns:
true if now terminated; false if already terminated
See Also:
IStateController.isMonitoringTerminated()

isMonitoringTerminated

public final boolean isMonitoringTerminated()
Description copied from interface: IStateController
Returns whether monitoring is permanently terminated.

Specified by:
isMonitoringTerminated in interface IStateController
Returns:
true if monitoring is permanently terminated, false if monitoring is enabled or disabled.
See Also:
IStateController.terminateMonitoring()

enableMonitoring

public final boolean enableMonitoring()
Description copied from interface: IStateController
Enables monitoring.

Specified by:
enableMonitoring in interface IStateController
Returns:
true if monitoring is enabled, false otherwise

disableMonitoring

public final boolean disableMonitoring()
Description copied from interface: IStateController
Disables monitoring. If monitoring is disabled, the MonitoringController simply pauses. Furthermore, probes should stop collecting new data and monitoring writers stop should stop writing existing data.

Specified by:
disableMonitoring in interface IStateController
Returns:
true if monitoring is disabled, false otherwise

isMonitoringEnabled

public final boolean isMonitoringEnabled()
Description copied from interface: IStateController
Returns whether monitoring is enabled or disabled/terminated.

Specified by:
isMonitoringEnabled in interface IStateController
Returns:
true of monitoring is enabled, false if monitoring is disabled or terminated.
See Also:
IStateController.disableMonitoring(), IStateController.enableMonitoring()

isDebug

public final boolean isDebug()
Description copied from interface: IStateController
Is the debug mode enabled?

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.

Specified by:
isDebug in interface IStateController
Returns:
debug mode

getName

public final java.lang.String getName()
Description copied from interface: IStateController
Returns the name of this controller.

Specified by:
getName in interface IStateController
Returns:
String

getHostname

public final java.lang.String getHostname()
Description copied from interface: IStateController
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. When you want to distinguish multiple Virtual Machines on one host, you* have to set the hostname manually in the Configuration.

Specified by:
getHostname in interface IStateController
Returns:
The hostname.

incExperimentId

public final int incExperimentId()
Description copied from interface: IStateController
Increments the experiment ID by 1 and returns the new value.

Specified by:
incExperimentId in interface IStateController
Returns:
experimentID

setExperimentId

public final void setExperimentId(int newExperimentID)
Description copied from interface: IStateController
Sets the experiment ID to the given value.

Specified by:
setExperimentId in interface IStateController
Parameters:
newExperimentID - The new ID.

getExperimentId

public final int getExperimentId()
Specified by:
getExperimentId in interface IStateController
Returns:
The experiment ID.

newMonitoringRecord

public final boolean newMonitoringRecord(IMonitoringRecord record)
Description copied from interface: 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.

Specified by:
newMonitoringRecord in interface IMonitoringRecordReceiver
Specified by:
newMonitoringRecord in interface IWriterController
Parameters:
record - the record.
Returns:
true on success; false in case of an error.

getNumberOfInserts

public final long getNumberOfInserts()
Description copied from interface: IWriterController
Shows how many inserts have been performed since last restart of the execution environment.

Specified by:
getNumberOfInserts in interface IWriterController
Returns:
long

schedulePeriodicSampler

public final ScheduledSamplerJob schedulePeriodicSampler(ISampler sampler,
                                                         long initialDelay,
                                                         long period,
                                                         java.util.concurrent.TimeUnit timeUnit)
Description copied from interface: ISamplingController
Schedules the given ISampler with given initial delay, and period.

Specified by:
schedulePeriodicSampler in interface ISamplingController
Parameters:
sampler - The sampler to schedule.
initialDelay - The initial delay.
period - The period.
timeUnit - The time unit which determines how to interpret the given parameter.
Returns:
a ScheduledSamplerJob as a handler for removing the scheduled sampler later on by using the method ISamplingController.removeScheduledSampler(ScheduledSamplerJob).

removeScheduledSampler

public final boolean removeScheduledSampler(ScheduledSamplerJob sampler)
Description copied from interface: ISamplingController
Stops future executions of the given periodic ScheduledSamplerJob .

Specified by:
removeScheduledSampler in interface ISamplingController
Parameters:
sampler - The sampler to be removed.
Returns:
true if the sensor is not registered

getTimeSource

public final ITimeSource getTimeSource()
Description copied from interface: ITimeSourceController
Returns the ITimeSource used in this controller.

Specified by:
getTimeSource in interface ITimeSourceController
Returns:
ITimeSource

getJMXDomain

public final java.lang.String getJMXDomain()
Specified by:
getJMXDomain in interface IJMXController
Returns:
the JMX domain used

getUniqueIdForString

public final int getUniqueIdForString(java.lang.String string)
Description copied from interface: IRegistryController
Gets a unique id for a string.

Specified by:
getUniqueIdForString in interface IRegistryController
Parameters:
string - the string
Returns:
the unique id

getStringForUniqueId

public java.lang.String getStringForUniqueId(int id)
Description copied from interface: IRegistryController
Gets a string for a unique id.

Specified by:
getStringForUniqueId in interface IRegistryController
Parameters:
id - the unique id
Returns:
the string

getStringRegistry

public IRegistry<java.lang.String> getStringRegistry()
Description copied from interface: IRegistryController
Gets the used IRegistry.

Specified by:
getStringRegistry in interface IRegistryController
Returns:
the registry

activateProbe

public final boolean activateProbe(java.lang.String pattern)
Description copied from interface: IProbeController
Activates a probe.

Specified by:
activateProbe in interface IProbeController
Parameters:
pattern - pattern for the probe
Returns:
true on success

deactivateProbe

public final boolean deactivateProbe(java.lang.String pattern)
Description copied from interface: IProbeController
Deactivates a probe.

Specified by:
deactivateProbe in interface IProbeController
Parameters:
pattern - pattern for the probe
Returns:
true on success

isProbeActivated

public boolean isProbeActivated(java.lang.String signature)
Description copied from interface: IProbeController
Tests if a probe is active. This test is ignorant of the fact whether monitoring itself is enabled/disabled/terminated.

Specified by:
isProbeActivated in interface IProbeController
Parameters:
signature - signature of the probe
Returns:
true if the probe with this signature is active

setProbePatternList

public void setProbePatternList(java.util.List<java.lang.String> patternList)
Description copied from interface: IProbeController
Overwrites the current list of patterns with a new pattern list.

Specified by:
setProbePatternList in interface IProbeController
Parameters:
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.

getProbePatternList

public java.util.List<java.lang.String> getProbePatternList()
Description copied from interface: IProbeController
Returns the current list of patterns with a prefix indicating whether the pattern is active or not.

Specified by:
getProbePatternList in interface IProbeController
Returns:
list of strings with patterns where each string starts either with a + or -

getInstance

public static final IMonitoringController getInstance()

Kieker 1.12

Copyright 2015 Kieker Project, http://kieker-monitoring.net