de.mcs.jmeasurement.Monitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JMeasurement Show documentation
Show all versions of JMeasurement Show documentation
JMeasurement profiling programs in production enviroment
/*
* MCS Media Computer Software Copyright (c) 2005 by MCS
* -------------------------------------- Created on 23.04.2005 by w.klaas
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package de.mcs.jmeasurement;
/**
* This is the basic interface of an monitor. The monitor will measure the time
* between the call of the start() Methode and the call of the stop() methode.
* pause() will hold the measurement, resume() will resume it.
*
* @author w.klaas
*/
public interface Monitor {
/**
* get the ID of this monitor.
*
* @return the id of this monitor
*/
String getMonitoId();
/**
* starting the measurement of this monitor.
*
* @return boolean true
if the monitor could be startet,
* otherwise false
*
*/
boolean start();
/**
* pausing the measurement.
*
* @return boolean true
if the monitor could be paused,
* otherwise false
*/
boolean pause();
/**
* resume the measurement.
*
* @return boolean true
if the monitor could be resumed,
* otherwise false
*/
boolean resume();
/**
* increasing the measurement time with msec milliseconds. Works only when
* monitor is currently measuring.
*
* @param msec
* time to increase
*/
void increase(long msec);
/**
* decreasing the measurement time with msec milliseconds. Works only when
* monitor is currently measuring.
*
* @param msec
* time to decrease
*/
void decrease(long msec);
/**
* stopping the measurment.
*
* @return boolean true
if the monitor could be stopped,
* otherwise false
*/
boolean stop();
/**
* resetting the measurement. If this methode is called all information
* about this monitor is destroyed.
*/
void reset();
/**
* @return long getting the measured time.
*/
long getAccrued();
/**
* @return boolean the monitor is actual running
*/
boolean isRunning();
/**
* @return boolean the monitor is actual paused
*/
boolean isPaused();
/**
* @return this monitor has recorded an exception.
* @since 0.64
*/
boolean hasException();
/**
* @return the text of the recorded exception or null.
* @since 0.64
*/
String getException();
/**
* setting a exception. This also stops the monitor, if it's running. The
* measuredata will not be accumulated.
*
* @param text
* the text for this exception.
* @since 0.64
*/
void setException(String text);
/**
* setting a exception. This also stops the monitor, if it's running. The
* measuredata will not be accumulated.
*
* @param cause
* the exception to store.
* @since 0.66
*/
void setException(Throwable cause);
}