Plexus v0.13.1

com.phoenixst.collections
Interface Reaper

All Known Implementing Classes:
RunnableReaper

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.

Since:
1.0
Version:
$Revision: 1.12 $
Author:
Ray A. Conner

Method Summary
 Reference createReference(Reapable reapable, Object referent)
          Creates and returns a Reference for the given arguments.
 

Method Detail

createReference

Reference createReference(Reapable reapable,
                          Object referent)
Creates and returns a 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

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.