001package org.javasimon.source;
002
003import org.javasimon.Split;
004import org.javasimon.Stopwatch;
005
006/**
007 * Cached sources using {@link org.javasimon.Stopwatch} as monitors.
008 *
009 * @author <a href="mailto:virgo47@gmail.com">Richard "Virgo" Richter</a>
010 * @since 3.4
011 */
012public abstract class CachedStopwatchSource<L, K> extends CachedMonitorSource<L, Stopwatch, K> implements StopwatchSource<L> {
013        public CachedStopwatchSource(StopwatchSource<L> delegate) {
014                super(delegate);
015        }
016
017        @Override
018        public Split start(L location) {
019                if (isMonitored(location)) {
020                        return getMonitor(location).start();
021                }
022                return Split.DISABLED;
023        }
024}