Skip to content

Commit ba24f96

Browse files
Kiran Sidhartha Ravikumarcoffeys
authored andcommitted
8251861: Remove unused jdk.internal.ref.SoftCleanable and WeakCleanable
Reviewed-by: mchung, rriggs
1 parent 6ed4c89 commit ba24f96

File tree

4 files changed

+2
-635
lines changed

4 files changed

+2
-635
lines changed

src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java

Lines changed: 2 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
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
@@ -52,10 +52,6 @@ public final class CleanerImpl implements Runnable {
5252
*/
5353
final PhantomCleanable<?> phantomCleanableList;
5454

55-
final WeakCleanable<?> weakCleanableList;
56-
57-
final SoftCleanable<?> softCleanableList;
58-
5955
// The ReferenceQueue of pending cleaning actions
6056
final ReferenceQueue<Object> queue;
6157

@@ -87,8 +83,6 @@ static CleanerImpl getCleanerImpl(Cleaner cleaner) {
8783
public CleanerImpl() {
8884
queue = new ReferenceQueue<>();
8985
phantomCleanableList = new PhantomCleanableRef();
90-
weakCleanableList = new WeakCleanableRef();
91-
softCleanableList = new SoftCleanableRef();
9286
}
9387

9488
/**
@@ -135,9 +129,7 @@ public void run() {
135129
InnocuousThread mlThread = (t instanceof InnocuousThread)
136130
? (InnocuousThread) t
137131
: null;
138-
while (!phantomCleanableList.isListEmpty() ||
139-
!weakCleanableList.isListEmpty() ||
140-
!softCleanableList.isListEmpty()) {
132+
while (!phantomCleanableList.isListEmpty()) {
141133
if (mlThread != null) {
142134
// Clear the thread locals
143135
mlThread.eraseThreadLocals();
@@ -207,109 +199,6 @@ public void clear() {
207199
}
208200
}
209201

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-
313202
/**
314203
* A ThreadFactory for InnocuousThreads.
315204
* The factory is a singleton.

src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)