Modifier and Type | Field and Description |
---|---|
static Reaper |
DEFAULT_INSTANCE
A single default Reaper which to be used when a structure
doesn't mind sharing the reaping thread with other things.
|
Constructor and Description |
---|
RunnableReaper()
Creates a new
RunnableReaper which sleeps for 0.1
seconds after emptying its internal ReferenceQueue of waiting
References and notifying the corresponding
Reapables . |
RunnableReaper(long sleepTime)
Creates a new
RunnableReaper which sleeps for the
specified number of milliseconds after emptying its internal
ReferenceQueue of waiting References and notifying the
corresponding Reapables . |
Modifier and Type | Method and Description |
---|---|
Reference |
createReference(Reapable reapable,
Object referent)
Creates and returns a
Reference for the given
arguments. |
static Reaper |
getInstance(String name)
Creates a new
RunnableReaper which sleeps for 0.1
seconds after emptying its internal ReferenceQueue of waiting
References and notifying the corresponding
Reapables . |
static Reaper |
getInstance(String name,
long sleepTime,
int threadPriority)
Creates a new
RunnableReaper which sleeps for the
specified number of milliseconds after emptying its internal
ReferenceQueue of waiting References and notifying the
corresponding Reapables . |
void |
run() |
public static final Reaper DEFAULT_INSTANCE
public RunnableReaper()
RunnableReaper
which sleeps for 0.1
seconds after emptying its internal ReferenceQueue of waiting
References and notifying the corresponding
Reapables
. It is up to the user to create a
thread to run this Reaper; alternatively, one of the static
factory methods can be used.public RunnableReaper(long sleepTime)
RunnableReaper
which sleeps for the
specified number of milliseconds after emptying its internal
ReferenceQueue of waiting References and notifying the
corresponding Reapables
. It is up to the user to
create a thread to run this Reaper; alternatively, one of the
static factory methods can be used.public static Reaper getInstance(String name)
RunnableReaper
which sleeps for 0.1
seconds after emptying its internal ReferenceQueue of waiting
References and notifying the corresponding
Reapables
. A new thread of minimum priority to
run the RunnableReaper
is also created and
started by this method.public static Reaper getInstance(String name, long sleepTime, int threadPriority)
RunnableReaper
which sleeps for the
specified number of milliseconds after emptying its internal
ReferenceQueue of waiting References and notifying the
corresponding Reapables
. A new thread of the
specified priority to run the RunnableReaper
is
also created and started by this method.public Reference createReference(Reapable reapable, Object referent)
Reaper
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.
createReference
in interface Reaper
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.