org.ow2.util.pool.impl.enhanced.internal.thread.impl
Class CleanerReferencer

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.WeakReference<Cleaner>
          extended by org.ow2.util.pool.impl.enhanced.internal.thread.impl.CleanerReferencer
All Implemented Interfaces:
java.lang.Runnable

public final class CleanerReferencer
extends java.lang.ref.WeakReference<Cleaner>
implements java.lang.Runnable

Keep a reference on cleaner. If cleaner does not have anything to clean then we keep only a weak reference on cleaner. So if cleaner is not used anywhere else, the cleaner is garbage collected. It produce the end of the thread running this object. And normally this object should be also garbage collected. Warning : if you do not call add after creating a weak reference which use queue of cleaner, then the thread running keeper could be terminated whereas cleaner is not garbage collected. The cleaner will not continue to work but no error will occurs. This class is final because its constructor starts a thread on its instances.

Author:
Gael Lalire

Constructor Summary
CleanerReferencer(Cleaner cleaner)
           
 
Method Summary
 void add()
           
 void run()
           
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, get, isEnqueued
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CleanerReferencer

public CleanerReferencer(Cleaner cleaner)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

add

public void add()


Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.