本文整理匯總了Java中com.twitter.finagle.stats.Counter類的典型用法代碼示例。如果您正苦於以下問題:Java Counter類的具體用法?Java Counter怎麽用?Java Counter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Counter類屬於com.twitter.finagle.stats包,在下文中一共展示了Counter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getResponseCounter
import com.twitter.finagle.stats.Counter; //導入依賴的package包/類
private Counter getResponseCounter(StatusCode code) {
Counter counter = responseStats.get(code);
if (null == counter) {
Counter newCounter = responseStatsReceiver.counter0(code.name());
Counter oldCounter = responseStats.putIfAbsent(code, newCounter);
counter = null != oldCounter ? oldCounter : newCounter;
}
return counter;
}
示例2: getExceptionCounter
import com.twitter.finagle.stats.Counter; //導入依賴的package包/類
private Counter getExceptionCounter(Class<?> cls) {
Counter counter = exceptionStats.get(cls);
if (null == counter) {
Counter newCounter = exceptionStatsReceiver.counter0(cls.getName());
Counter oldCounter = exceptionStats.putIfAbsent(cls, newCounter);
counter = null != oldCounter ? oldCounter : newCounter;
}
return counter;
}