Top Description Inners Fields Constructors Methods
com.sun.javafx.util

public Class WeakReferenceQueue<E>

extends Object
Class Inheritance
Imports
java.lang.ref.ReferenceQueue, .WeakReference, java.util.Iterator

This is a helper class for handling weak references across all devices. We tried to use WeakHashMap, but it isn't available on mobile. We tried to add it to mobile, but it requires ReferenceQueue and it appears that ReferenceQueue requires support from the VM which we don't know that we have on mobile. So this class attempts to lesson the likelyhood of memory leaks. As we abandoned mobile, we considered removal of this class. But replacement by WeakHashMap is not always possible as we use mutable elements. At least it was now possible to optimize this class using the ReferenceQueue.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ReferenceQueue<T>
garbage

Reference queue for cleared weak references

private WeakReferenceQueue.ListEntry
pack-priv int
size

Size of the queue

private Object
strongRef

Strongly referenced list head

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(E obj)

public void
public Iterator<? super E>
public void
remove(E obj)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

garbageback to summary
private final ReferenceQueue<T> garbage

Reference queue for cleared weak references

sizeback to summary
pack-priv int size

Size of the queue

strongRefback to summary
private Object strongRef

Strongly referenced list head

Constructor Detail

WeakReferenceQueueback to summary
public WeakReferenceQueue()

Method Detail

addback to summary
public void add(E obj)
cleanupback to summary
public void cleanup()
iteratorback to summary
public Iterator<? super E> iterator()
removeback to summary
public void remove(E obj)
com.sun.javafx.util back to summary

private Class WeakReferenceQueue.ListEntry

extends WeakReference
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv WeakReferenceQueue.ListEntry
pack-priv WeakReferenceQueue.ListEntry

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void

Field Detail

nextback to summary
pack-priv WeakReferenceQueue.ListEntry next

Hides java.lang.ref.Reference.next.

prevback to summary
pack-priv WeakReferenceQueue.ListEntry prev

Constructor Detail

ListEntryback to summary
public ListEntry(Object o, ReferenceQueue<T> queue)

Method Detail

insertback to summary
public void insert(WeakReferenceQueue.ListEntry where)
removeback to summary
public void remove()