Package org.codehaus.groovy.util
Class ManagedReference<T>
java.lang.Object
org.codehaus.groovy.util.ManagedReference<T>
- Type Parameters:
T- the referent type
- All Implemented Interfaces:
Finalizable
Reference wrapper that couples a referent with a
ReferenceManager cleanup lifecycle.-
Constructor Summary
ConstructorsConstructorDescriptionManagedReference(ReferenceBundle bundle, T value) Creates a managed reference using the supplied bundle.ManagedReference(ReferenceType type, ReferenceManager rmanager, T value) Creates a managed reference using the supplied reference kind and manager. -
Method Summary
-
Constructor Details
-
ManagedReference
Creates a managed reference using the supplied reference kind and manager.- Parameters:
type- the reference implementation to creatermanager- the manager that processes collected referencesvalue- the referent to store
-
ManagedReference
Creates a managed reference using the supplied bundle.- Parameters:
bundle- the reference bundle describing the type and manager to usevalue- the referent to store
-
-
Method Details
-
get
Returns the current referent.- Returns:
- the referent, or
nullif it is no longer available
-
clear
public final void clear()Clears the referent and lets the manager process any queued stale entries. -
finalizeReference
public void finalizeReference()Performs any cleanup required after the associated reference has been cleared.- Specified by:
finalizeReferencein interfaceFinalizable
-