int (final int numerator, final int denominator) { assert numerator >= 0 : "numerator(" + numerator + ") must be >=0"; assert denominator > 0 : "denominator(" + denominator + ") must be >0"; while (true) {//CAS loop: final int tokens = tokensOfUsefulness; final int decayedTokens = tokens * numerator / denominator; if (TOKENS_UPDATER.compareAndSet(this, tokens, decayedTokens)) { return decayedTokens; } } }