001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.monitoring.statistics;
016    
017    /**
018     * @author Rajesh Thiagarajan
019     * @author Brian Wing Shun Chan
020     */
021    public class CountStatistics extends BaseStatistics {
022    
023            public CountStatistics(String name) {
024                    super(name);
025            }
026    
027            public void decrementCount() {
028                    _count--;
029    
030                    setLastSampleTime(System.currentTimeMillis());
031            }
032    
033            public long getCount() {
034                    return _count;
035            }
036    
037            public void incrementCount() {
038                    _count++;
039    
040                    setLastSampleTime(System.currentTimeMillis());
041            }
042    
043            public void reset() {
044                    super.reset();
045    
046                    _count = 0;
047            }
048    
049            public void setCount(long count) {
050                    _count = count;
051    
052                    setLastSampleTime(System.currentTimeMillis());
053            }
054    
055            private long _count;
056    
057    }