You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Anty <an...@gmail.com> on 2010/06/05 10:31:04 UTC
Fwd: PhantomReference in Cassandra
---------- Forwarded message ----------
From: Anty <an...@gmail.com>
Date: Sat, Jun 5, 2010 at 4:30 PM
Subject: PhantomReference in Cassandra
To: user@cassandra.apache.org, chukwa-dev <ch...@hadoop.apache.org>
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
--
Best Regards
Anty Rao
Re: PhantomReference in Cassandra
Posted by Brandon Williams <dr...@gmail.com>.
On Tue, Jun 8, 2010 at 9:44 PM, Anty <an...@gmail.com> wrote:
> In theory ,it could do some help.
I tried this and unfortunately there was no noticeable difference.
-Brandon
Re: PhantomReference in Cassandra
Posted by Anty <an...@gmail.com>.
In theory ,it could do some help.
On Sat, Jun 5, 2010 at 9:10 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> From what I have read, allowing the reference to be GC'd itself is
> equivalent to calling clear. Does adding clear() make an observable
> difference?
>
> On Sat, Jun 5, 2010 at 1:31 AM, Anty <an...@gmail.com> wrote:
> > ---------- Forwarded message ----------
> > From: Anty <an...@gmail.com>
> > Date: Sat, Jun 5, 2010 at 4:30 PM
> > Subject: PhantomReference in Cassandra
> > To: user@cassandra.apache.org, chukwa-dev <ch...@hadoop.apache.org>
> >
> >
> > 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
> >
> >
> >
> > --
> > Best Regards
> > Anty Rao
> >
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com
>
--
Best Regards
Anty Rao
Re: PhantomReference in Cassandra
Posted by Jonathan Ellis <jb...@gmail.com>.
>From what I have read, allowing the reference to be GC'd itself is
equivalent to calling clear. Does adding clear() make an observable
difference?
On Sat, Jun 5, 2010 at 1:31 AM, Anty <an...@gmail.com> wrote:
> ---------- Forwarded message ----------
> From: Anty <an...@gmail.com>
> Date: Sat, Jun 5, 2010 at 4:30 PM
> Subject: PhantomReference in Cassandra
> To: user@cassandra.apache.org, chukwa-dev <ch...@hadoop.apache.org>
>
>
> 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
>
>
>
> --
> Best Regards
> Anty Rao
>
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com