|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Reaper
The interface defining an object which reaps Reapables
. This interface, along with the ReapableCollection
class, is intended to be used to solve the
problem presented by the following requirements:
A typical example would be a more robust Iterator
which can actually deal with changes to the underlying data
structure while iteration is in progress.
However, this is not the only use-case. A Reaper
can also be used when there is no need to keep track of the
currently reachable referents. A Reapable
instance
could be created specific to each referent, to perform specific
cleanup actions. This would work as long as the referent is not
reachable from the Reapable
.
Method Summary | |
---|---|
Reference |
createReference(Reapable reapable,
Object referent)
Creates and returns a Reference for the given
arguments. |
Method Detail |
---|
Reference createReference(Reapable reapable, Object referent)
Reference
for the given
arguments. Sometime after the Reference
is
reclaimed by the garbage collector, the argument's Reapable.reap()
method will be called. Please note that there
is typically no guarantee that this method will ever be
called, so this mechanism should not be relied upon as a
replacement for a try/finally block.
Implementations should never return
PhantomReferences
if the referent needs to be
retrievable while it is still referencable through other
paths, or if the Reference.clear()
is not
guaranteed to be called.
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |