@VisibleForTesting public void clear() { lockForRescale(); try { final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { decayingBuckets.set(i, 0L); buckets.set(i, 0L); } } finally { unlockForRescale(); } }
@VisibleForTesting public void clear() { lockForRescale(); try { final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { decayingBuckets.set(i, 0L); buckets.set(i, 0L); } } finally { unlockForRescale(); } }
@VisibleForTesting public void clear() { lockForRescale(); try { final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { decayingBuckets.set(i, 0L); buckets.set(i, 0L); } } finally { unlockForRescale(); } }
@VisibleForTesting public void clear() { lockForRescale(); try { final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { decayingBuckets.set(i, 0L); buckets.set(i, 0L); } } finally { unlockForRescale(); } }
private void rescale(long now) { // Check again to make sure that another thread didn't complete rescale already if (needRescale(now)) { lockForRescale(); try { final double rescaleFactor = forwardDecayWeight(now); decayLandmark = now; final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { long newValue = Math.round((decayingBuckets.get(i) / rescaleFactor)); decayingBuckets.set(i, newValue); } } finally { unlockForRescale(); } } }
private void rescale(long now) { // Check again to make sure that another thread didn't complete rescale already if (needRescale(now)) { lockForRescale(); try { final double rescaleFactor = forwardDecayWeight(now); decayLandmark = now; final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { long newValue = Math.round((decayingBuckets.get(i) / rescaleFactor)); decayingBuckets.set(i, newValue); } } finally { unlockForRescale(); } } }
private void rescale(long now) { // Check again to make sure that another thread didn't complete rescale already if (needRescale(now)) { lockForRescale(); try { final double rescaleFactor = forwardDecayWeight(now); decayLandmark = now; final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { long newValue = Math.round((decayingBuckets.get(i) / rescaleFactor)); decayingBuckets.set(i, newValue); } } finally { unlockForRescale(); } } }
private void rescale(long now) { // Check again to make sure that another thread didn't complete rescale already if (needRescale(now)) { lockForRescale(); try { final double rescaleFactor = forwardDecayWeight(now); decayLandmark = now; final int bucketCount = decayingBuckets.length(); for (int i = 0; i < bucketCount; i++) { long newValue = Math.round((decayingBuckets.get(i) / rescaleFactor)); decayingBuckets.set(i, newValue); } } finally { unlockForRescale(); } } }