Kieker 1.7

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:
IJMXController, IMonitoringController, IProbeController, IRegistryController, ISamplingController, IStateController, ITimeSourceController, IWriterController, IMonitoringRecordReceiver

public final class MonitoringController
extends AbstractController
implements IMonitoringController

Since:
1.3
Author:
Jan Waller

Method Summary
 boolean activateProbe(String pattern)
          Activates a probe.
static IMonitoringController createInstance(Configuration configuration)
          This is a factory method creating a new monitoring controller instance using the given configuration.
 boolean deactivateProbe(String pattern)
          Deactivates a probe.
 boolean disableMonitoring()
          Disables monitoring.
 boolean enableMonitoring()
          Enables monitoring.
 int getExperimentId()
           
 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.
 int getIdForString(String string)
          Gets a unique id for a string.
static IMonitoringController getInstance()
           
 String getJMXDomain()
           
 String getName()
          Returns the name of this controller.
 long getNumberOfInserts()
          Shows how many inserts have been performed since last restart of the execution environment.
 List<String> getProbePatternList()
          Returns the current list of patterns with a prefix indicating whether the pattern is active or not.
 ITimeSource getTimeSource()
          Returns the ITimeSource used in this controller.
static String getVersion()
          Return the version name of this controller instance.
 int incExperimentId()
          Increments the experiment ID by 1 and returns the new value.
 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(String signature)
          Tests if a probe is active.
 boolean newMonitoringRecord(IMonitoringRecord record)
          Called for each new record.
 boolean removeScheduledSampler(ScheduledSamplerJob sampler)
          Stops future executions of the given periodic ScheduledSamplerJob .
 ScheduledSamplerJob schedulePeriodicSampler(ISampler sampler, long initialDelay, long period, 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(List<String> patternList)
          Overwrites the current list of patterns with a new pattern list.
 boolean terminateMonitoring()
          Permanently terminates monitoring.
 String toString()
          This method is used to log the status of the controllers to the console.
 
Methods inherited from class java.lang.Object
equals, 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 String getVersion()
Return the version name of this controller instance.

Returns:
the version name

toString

public final 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.

terminateMonitoring

public final boolean terminateMonitoring()
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()
Enables monitoring.

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

disableMonitoring

public final boolean disableMonitoring()
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 String getName()
Description copied from interface: IStateController
Returns the name of this controller.

Specified by:
getName in interface IStateController
Returns:
String

getHostname

public final 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()
Increments the experiment ID by 1 and returns the new value.

Specified by:
incExperimentId in interface IStateController
Returns:
The new experiment ID.

setExperimentId

public final void setExperimentId(int newExperimentID)
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)
Called for each new record. Notice, that this method should not throw an exception, but indicate an error by the return value false.

Specified by:
newMonitoringRecord in interface IWriterController
Specified by:
newMonitoringRecord in interface IMonitoringRecordReceiver
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,
                                                         TimeUnit timeUnit)
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)
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 String getJMXDomain()
Specified by:
getJMXDomain in interface IJMXController
Returns:
the JMX domain used

getIdForString

public final int getIdForString(String string)
Gets a unique id for a string.

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

activateProbe

public final boolean activateProbe(String pattern)
Activates a probe.

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

deactivateProbe

public final boolean deactivateProbe(String pattern)
Deactivates a probe.

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

isProbeActivated

public boolean isProbeActivated(String signature)
Tests if a probe is active.

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(List<String> patternList)
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 -

getProbePatternList

public List<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.7

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