* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.logging;
import org.onap.aai.logging.LoggingContext.LoggingField;
public final class StopWatch {
- private StopWatch() {}
-
- public static void start() {
- LoggingContext.stopWatchStart();
- }
-
- public static double stop() {
- return LoggingContext.stopWatchStop();
- }
- public static void conditionalStart() {
- if ( LoggingContext.isStopWatchStarted() ) {
- return;
- }
- start();
- }
- public static double stopIfStarted() {
- if ( LoggingContext.isStopWatchStarted() ) {
- return (stop());
- }
- return (0);
- }
- public static void clear() {
- LoggingContext.remove(LoggingField.STOP_WATCH_START.toString());
- LoggingContext.remove(LoggingField.ELAPSED_TIME.toString());
- }
+ private StopWatch() {
+ }
+
+ public static void start() {
+ LoggingContext.stopWatchStart();
+ }
+
+ public static double stop() {
+ return LoggingContext.stopWatchStop();
+ }
+
+ public static void conditionalStart() {
+ if (LoggingContext.isStopWatchStarted()) {
+ return;
+ }
+ start();
+ }
+
+ public static double stopIfStarted() {
+ if (LoggingContext.isStopWatchStarted()) {
+ return (stop());
+ }
+ return (0);
+ }
+
+ public static void clear() {
+ LoggingContext.remove(LoggingField.STOP_WATCH_START.toString());
+ LoggingContext.remove(LoggingField.ELAPSED_TIME.toString());
+ }
}