cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schubert Zhang <zson...@gmail.com>
Subject Re: PhantomReference in Cassandra
Date Sun, 18 Jul 2010 16:09:37 GMT
Up

On Sat, Jun 5, 2010 at 4:30 PM, Anty <anty.rao@gmail.com> wrote:

> Hi:All
> in the code of SSTableReader.java
>  private static final ReferenceQueue<SSTableReader> finalizerQueue = new
> ReferenceQueue<SSTableReader>()
>     {{
>         Runnable runnable = new Runnable()
>         {
>             public void run()
>             {
>                 while (true)
>                 {
>                     SSTableDeletingReference r = null;
>                     try
>                     {
>                         r = (SSTableDeletingReference)
> finalizerQueue.remove();
>                         finalizers.remove(r);
>                     }
>                     catch (InterruptedException e)
>                     {
>                         throw new RuntimeException(e);
>                     }
>                     try
>                     {
>                         r.cleanup();
>                     }
>                     catch (IOException e)
>                     {
>                         logger.error("Error deleting " + r.path, e);
>                     }
>                 }
>             }
>         };
>         new Thread(runnable, "SSTABLE-DELETER").start();
>     }};
>
>
> the PhantomReference SSTableDeletingReference's cleanup() method doesn't
> invoked clear() method inherited from Reference, whichi clear the phantom
> reference to the referent.
> but,the GC enqueues the PhantomReference onto ReferenceQueue before the
> phantom reference clears. Is it necessary to invoke the clear() method after
> r.clearup() or add clear() method in cleanup() method to accelerate the GC
> process.
>     try
>                     {
>                         r.cleanup();
>                         r.clear();
>
>                     }
>                     catch (IOException e)
>                     {
>                         logger.error("Error deleting " + r.path, e);
>                     }
> --
> Best Regards
> Anty Rao
>

Mime
View raw message