001/* 002 * Copyright (c) 2007-2017 Xplenty, Inc. All Rights Reserved. 003 * 004 * Project and contact information: http://www.cascading.org/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.stats; 022 023import java.util.Collection; 024 025/** 026 * 027 */ 028public interface ProvidesCounters 029 { 030 /** 031 * Method getLastSuccessfulCounterFetchTime returns the time, in millis, the last moment counters 032 * were successfully retrieved. 033 * <p/> 034 * If -1, counter values were never successfully retrieved. 035 * <p/> 036 * If this return value is less than the {@link CascadingStats#getFinishedTime()} it is likely the 037 * counter service became unavailable. 038 * 039 * @return the moment counters were last successfully retrieved 040 */ 041 long getLastSuccessfulCounterFetchTime(); 042 043 /** 044 * Method getCounterGroups returns all the available counter group names. 045 * 046 * @return the counterGroups (type Collection<String>) of this CascadingStats object. 047 */ 048 Collection<String> getCounterGroups(); 049 050 /** 051 * Method getCountersFor returns all the counter names for the give group name. 052 * 053 * @param group 054 * @return Collection<String> 055 */ 056 Collection<String> getCountersFor( String group ); 057 058 /** 059 * Method getCountersFor returns all the counter names for the counter Enum. 060 * 061 * @param group 062 * @return Collection<String> 063 */ 064 Collection<String> getCountersFor( Class<? extends Enum> group ); 065 066 /** 067 * Method getCounter returns the current value for the given counter Enum. 068 * 069 * @param counter of type Enum 070 * @return the current counter value 071 */ 072 long getCounterValue( Enum counter ); 073 074 /** 075 * Method getCounter returns the current value for the given group and counter. 076 * 077 * @param group of type String 078 * @param counter of type String 079 * @return the current counter value 080 */ 081 long getCounterValue( String group, String counter ); 082 }