|
1 | 1 | /* |
2 | | - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -52,10 +52,6 @@ public final class CleanerImpl implements Runnable { |
52 | 52 | */ |
53 | 53 | final PhantomCleanable<?> phantomCleanableList; |
54 | 54 |
|
55 | | - final WeakCleanable<?> weakCleanableList; |
56 | | - |
57 | | - final SoftCleanable<?> softCleanableList; |
58 | | - |
59 | 55 | // The ReferenceQueue of pending cleaning actions |
60 | 56 | final ReferenceQueue<Object> queue; |
61 | 57 |
|
@@ -87,8 +83,6 @@ static CleanerImpl getCleanerImpl(Cleaner cleaner) { |
87 | 83 | public CleanerImpl() { |
88 | 84 | queue = new ReferenceQueue<>(); |
89 | 85 | phantomCleanableList = new PhantomCleanableRef(); |
90 | | - weakCleanableList = new WeakCleanableRef(); |
91 | | - softCleanableList = new SoftCleanableRef(); |
92 | 86 | } |
93 | 87 |
|
94 | 88 | /** |
@@ -135,9 +129,7 @@ public void run() { |
135 | 129 | InnocuousThread mlThread = (t instanceof InnocuousThread) |
136 | 130 | ? (InnocuousThread) t |
137 | 131 | : null; |
138 | | - while (!phantomCleanableList.isListEmpty() || |
139 | | - !weakCleanableList.isListEmpty() || |
140 | | - !softCleanableList.isListEmpty()) { |
| 132 | + while (!phantomCleanableList.isListEmpty()) { |
141 | 133 | if (mlThread != null) { |
142 | 134 | // Clear the thread locals |
143 | 135 | mlThread.eraseThreadLocals(); |
@@ -207,109 +199,6 @@ public void clear() { |
207 | 199 | } |
208 | 200 | } |
209 | 201 |
|
210 | | - /** |
211 | | - * Perform cleaning on an unreachable WeakReference. |
212 | | - */ |
213 | | - public static final class WeakCleanableRef extends WeakCleanable<Object> { |
214 | | - private final Runnable action; |
215 | | - |
216 | | - /** |
217 | | - * Constructor for a weak cleanable reference. |
218 | | - * @param obj the object to monitor |
219 | | - * @param cleaner the cleaner |
220 | | - * @param action the action Runnable |
221 | | - */ |
222 | | - WeakCleanableRef(Object obj, Cleaner cleaner, Runnable action) { |
223 | | - super(obj, cleaner); |
224 | | - this.action = action; |
225 | | - } |
226 | | - |
227 | | - /** |
228 | | - * Constructor used only for root of weak cleanable list. |
229 | | - */ |
230 | | - WeakCleanableRef() { |
231 | | - super(); |
232 | | - this.action = null; |
233 | | - } |
234 | | - |
235 | | - @Override |
236 | | - protected void performCleanup() { |
237 | | - action.run(); |
238 | | - } |
239 | | - |
240 | | - /** |
241 | | - * Prevent access to referent even when it is still alive. |
242 | | - * |
243 | | - * @throws UnsupportedOperationException always |
244 | | - */ |
245 | | - @Override |
246 | | - public Object get() { |
247 | | - throw new UnsupportedOperationException("get"); |
248 | | - } |
249 | | - |
250 | | - /** |
251 | | - * Direct clearing of the referent is not supported. |
252 | | - * |
253 | | - * @throws UnsupportedOperationException always |
254 | | - */ |
255 | | - @Override |
256 | | - public void clear() { |
257 | | - throw new UnsupportedOperationException("clear"); |
258 | | - } |
259 | | - } |
260 | | - |
261 | | - /** |
262 | | - * Perform cleaning on an unreachable SoftReference. |
263 | | - */ |
264 | | - public static final class SoftCleanableRef extends SoftCleanable<Object> { |
265 | | - private final Runnable action; |
266 | | - |
267 | | - /** |
268 | | - * Constructor for a soft cleanable reference. |
269 | | - * @param obj the object to monitor |
270 | | - * @param cleaner the cleaner |
271 | | - * @param action the action Runnable |
272 | | - */ |
273 | | - SoftCleanableRef(Object obj, Cleaner cleaner, Runnable action) { |
274 | | - super(obj, cleaner); |
275 | | - this.action = action; |
276 | | - } |
277 | | - |
278 | | - /** |
279 | | - * Constructor used only for root of soft cleanable list. |
280 | | - */ |
281 | | - SoftCleanableRef() { |
282 | | - super(); |
283 | | - this.action = null; |
284 | | - } |
285 | | - |
286 | | - @Override |
287 | | - protected void performCleanup() { |
288 | | - action.run(); |
289 | | - } |
290 | | - |
291 | | - /** |
292 | | - * Prevent access to referent even when it is still alive. |
293 | | - * |
294 | | - * @throws UnsupportedOperationException always |
295 | | - */ |
296 | | - @Override |
297 | | - public Object get() { |
298 | | - throw new UnsupportedOperationException("get"); |
299 | | - } |
300 | | - |
301 | | - /** |
302 | | - * Direct clearing of the referent is not supported. |
303 | | - * |
304 | | - * @throws UnsupportedOperationException always |
305 | | - */ |
306 | | - @Override |
307 | | - public void clear() { |
308 | | - throw new UnsupportedOperationException("clear"); |
309 | | - } |
310 | | - |
311 | | - } |
312 | | - |
313 | 202 | /** |
314 | 203 | * A ThreadFactory for InnocuousThreads. |
315 | 204 | * The factory is a singleton. |
|
0 commit comments