5454public final class ObjectHandlesImpl implements ObjectHandles {
5555
5656 /** Private subclass to distinguish from regular handles to {@link WeakReference} objects. */
57- private static final class HandleWeakReference <T > extends WeakReference <T > {
58- HandleWeakReference (T referent ) {
59- super (referent );
60- }
61- }
6257
6358 private static final int MAX_FIRST_BUCKET_CAPACITY = 1024 ;
6459 static { // must be a power of 2 for the arithmetic below to work
@@ -210,17 +205,10 @@ public ObjectHandle create(Object obj) {
210205 }
211206 }
212207
213- public ObjectHandle createWeak (Object obj ) {
214- return create (new HandleWeakReference <>(obj ));
215- }
216-
217208 @ SuppressWarnings ("unchecked" )
218209 @ Override
219210 public <T > T get (ObjectHandle handle ) {
220211 Object obj = doGet (handle );
221- if (obj instanceof HandleWeakReference ) {
222- obj = ((HandleWeakReference <T >) obj ).get ();
223- }
224212 return (T ) obj ;
225213 }
226214
@@ -240,10 +228,6 @@ private Object doGet(ObjectHandle handle) {
240228 return Unsafe .getUnsafe ().getReferenceVolatile (bucket , getObjectArrayByteOffset (indexInBucket ));
241229 }
242230
243- public boolean isWeak (ObjectHandle handle ) {
244- return (doGet (handle ) instanceof HandleWeakReference );
245- }
246-
247231 @ Override
248232 public void destroy (ObjectHandle handle ) {
249233 if (handle .equal (nullHandle )) {
@@ -261,10 +245,6 @@ public void destroy(ObjectHandle handle) {
261245 Unsafe .getUnsafe ().putReferenceRelease (bucket , getObjectArrayByteOffset (indexInBucket ), null );
262246 }
263247
264- public void destroyWeak (ObjectHandle handle ) {
265- destroy (handle );
266- }
267-
268248 public long computeCurrentCount () {
269249 long count = 0 ;
270250 int bucketIndex = 0 ;
0 commit comments