File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/java.base/share/classes/jdk/internal/ref Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2015, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -135,8 +135,14 @@ public void run() {
135135 mlThread .eraseThreadLocals ();
136136 }
137137 try {
138- // Wait for a Ref, with a timeout to avoid getting hung
139- // due to a race with clear/clean
138+ // Wait for a Ref, with a timeout to avoid a potential hang.
139+ // The Cleaner may become unreachable and its cleanable run,
140+ // while there are registered cleanables for other objects.
141+ // If the application explicitly calls clean() on all remaining
142+ // Cleanables, there won't be any references enqueued to unblock
143+ // this. Using a timeout is simpler than unblocking this by
144+ // having cleaning of the last registered cleanable enqueue a
145+ // dummy reference.
140146 Cleanable ref = (Cleanable ) queue .remove (60 * 1000L );
141147 if (ref != null ) {
142148 ref .clean ();
You can’t perform that action at this time.
0 commit comments