Top Description Inners Fields Constructors Methods
com.sun.prism.impl

public Class Disposer

extends Object
Class Inheritance
Imports
com.sun.javafx.tk.quantum.QuantumToolkit, java.lang.ref.Reference, .ReferenceQueue, .PhantomReference, .SoftReference, .WeakReference, java.util.Hashtable, .LinkedList

This class is used for registering and disposing the native data associated with Java objects. The object can register itself by calling one of the addRecord methods and providing either the pointer to the native disposal method or a descendant of the Disposer.Record interface with overridden dispose() method. When the object becomes unreachable, the dispose() method of the associated Disposer.Record object will be called.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Disposer.Record

This interface is used to hold the resource to be disposed.

public static interface
Disposer.Target

This is an interface which should be implemented by the classes which use Disposer.

Field Summary

Modifier and TypeField and Description
private final LinkedList<Disposer.Record>
private static Disposer
private static final int
private final ReferenceQueue<T>
private final Hashtable<K, V>
private static int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
private
Disposer()

Private constructor to prevent outside instantiation.

Method Summary

Modifier and TypeMethod and Description
private synchronized void
add(Object
Object to be registered, or if target is an instance of DisposerTarget, its associated disposer referent will be the Object that is registered
target
,
Disposer.Record
the associated DisposerRecord object
rec
)

Performs the actual registration of the target object to be disposed.

public static void
addRecord(Object
Object to be registered
target
,
Disposer.Record
the associated DisposerRecord object
rec
)

Registers the target object and the native data for later disposal when the target is unreachable.

private synchronized void
public static void
cleanUp()

Disposes all unreachable objects and all objects in the disposal queue.

public static void
disposeRecord(Disposer.Record
the DisposerRecord object to be disposed
rec
)

Add the object to the disposal queue.

private synchronized void
disposeUnreachables()

Polls the reference queue to see if there are any unreachable objects to be disposed.

private synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

disposalQueueback to summary
private final LinkedList<Disposer.Record> disposalQueue
disposerInstanceback to summary
private static Disposer disposerInstance
PHANTOMback to summary
private static final int PHANTOM
queueback to summary
private final ReferenceQueue<T> queue
recordsback to summary
private final Hashtable<K, V> records
refTypeback to summary
private static int refType
SOFTback to summary
private static final int SOFT
WEAKback to summary
private static final int WEAK

Constructor Detail

Disposerback to summary
private Disposer()

Private constructor to prevent outside instantiation.

Method Detail

addback to summary
private synchronized void add(Object target, Disposer.Record rec)

Performs the actual registration of the target object to be disposed.

Parameters
target:Object

Object to be registered, or if target is an instance of DisposerTarget, its associated disposer referent will be the Object that is registered

rec:Disposer.Record

the associated DisposerRecord object

See Also
DisposerRecord
addRecordback to summary
public static void addRecord(Object target, Disposer.Record rec)

Registers the target object and the native data for later disposal when the target is unreachable. .

Parameters
target:Object

Object to be registered

rec:Disposer.Record

the associated DisposerRecord object

See Also
DisposerRecord
addToDisposalQueueback to summary
private synchronized void addToDisposalQueue(Disposer.Record rec)
cleanUpback to summary
public static void cleanUp()

Disposes all unreachable objects and all objects in the disposal queue. It first polls the reference queue, calling the dispose method of each unreachable object. It then iterates the list of objects in the disposal queue, calling the dispose method of each object.

Note

This method must only be called from the Render Thread (the thread on which the resources were created).

disposeRecordback to summary
public static void disposeRecord(Disposer.Record rec)

Add the object to the disposal queue. The object will be disposed the next time cleanup is called.

Parameters
rec:Disposer.Record

the DisposerRecord object to be disposed

disposeUnreachablesback to summary
private synchronized void disposeUnreachables()

Polls the reference queue to see if there are any unreachable objects to be disposed. If there is work to be done, this method disposes all unreachable objects in the queue, otherwise it returns immediately.

processDisposalQueueback to summary
private synchronized void processDisposalQueue()
com.sun.prism.impl back to summary

public Interface Disposer.Record

Known Direct Implementers
com.sun.prism.impl.ps.CachingShapeRepState.CSRDisposerRecord, com.sun.pisces.AbstractSurface.AbstractSurfaceDisposerRecord, com.sun.pisces.PiscesRenderer.PiscesRendererDisposerRecord, com.sun.prism.null3d.DummyResource.DummyRecord, com.sun.prism.d3d.D3DMesh.D3DMeshDisposerRecord, com.sun.prism.d3d.D3DMeshView.D3DMeshViewDisposerRecord, com.sun.prism.d3d.D3DPhongMaterial.D3DPhongMaterialDisposerRecord, com.sun.prism.d3d.D3DResource.D3DRecord, com.sun.prism.es2.ES2TextureData, com.sun.prism.es2.ES2Mesh.ES2MeshDisposerRecord, com.sun.prism.es2.ES2MeshView.ES2MeshViewDisposerRecord, com.sun.prism.es2.ES2PhongMaterial.ES2PhongMaterialDisposerRecord, com.sun.prism.es2.ES2Shader.ES2ShaderDisposerRecord

This interface is used to hold the resource to be disposed.

Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

disposeback to summary
public void dispose()
com.sun.prism.impl back to summary

public Interface Disposer.Target


This is an interface which should be implemented by the classes which use Disposer.

Method Summary

Modifier and TypeMethod and Description
public Object
getDisposerReferent()

Returns an object which will be used as the referent in the ReferenceQueue.

Method Detail

getDisposerReferentback to summary
public Object getDisposerReferent()

Returns an object which will be used as the referent in the ReferenceQueue.