Skip to content

Commit ae1c451

Browse files
committed
No need to artificially limit cleanup rate
1 parent 75c3b33 commit ae1c451

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

utils/src/main/java/datadog/instrument/utils/ClassLoaderKey.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,19 @@ final class ClassLoaderKey extends WeakReference<ClassLoader> {
3838
// registered cleaners of stale class-loader keys and their values
3939
private static final List<Consumer<Reference<?>>> cleaners = new CopyOnWriteArrayList<>();
4040

41-
private static final int MAX_KEYS_CLEANED_PER_CYCLE = 8;
42-
4341
/** Registers a cleaner of stale class-loader keys. */
4442
static void registerCleaner(Consumer<Reference<?>> cleaner) {
4543
cleaners.add(cleaner);
4644
}
4745

4846
/** Checks for stale class-loader keys; stale keys are cleaned by the registered cleaners. */
4947
static void cleanStaleKeys() {
50-
int count = 0;
5148
Reference<?> ref;
5249
while ((ref = staleKeys.poll()) != null) {
5350
//noinspection ForLoopReplaceableByForEach - indexed loop performs better
5451
for (int i = 0, size = cleaners.size(); i < size; i++) {
5552
cleaners.get(i).accept(ref);
5653
}
57-
if (++count >= MAX_KEYS_CLEANED_PER_CYCLE) {
58-
break; // limit work done per call
59-
}
6054
}
6155
}
6256

0 commit comments

Comments
 (0)