Return-Path: Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: (qmail 5763 invoked from network); 9 Jun 2010 02:45:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Jun 2010 02:45:02 -0000 Received: (qmail 36477 invoked by uid 500); 9 Jun 2010 02:45:01 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 36413 invoked by uid 500); 9 Jun 2010 02:45:01 -0000 Mailing-List: contact dev-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list dev@cassandra.apache.org Received: (qmail 36405 invoked by uid 99); 9 Jun 2010 02:45:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jun 2010 02:45:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of anty.rao@gmail.com designates 209.85.212.44 as permitted sender) Received: from [209.85.212.44] (HELO mail-vw0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jun 2010 02:44:54 +0000 Received: by vws9 with SMTP id 9so888016vws.31 for ; Tue, 08 Jun 2010 19:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=OSt+/iwd2uOwA7JqBtzOnNd4MqbvfRnyvg2cnN9wXQ4=; b=bzn91W+eu1+0CLX3HB6/dmstaLiNZabrxPhc8fzvEiNwc4s7qq45YWY5ypKwQTwK76 fZQFQ6A4IgqSCNmgRiJcz55CG75qBec6N8j0GF1BKlN1wXQnXu703B8YSgXXhlzBxxB2 iZR/PXgE32mn/bBhdLJR4OgRJT0p4DetsbIdE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=PLuKIueEjsxCRM8V368eD1jXK9L/jqq5OoxEV462MKIo2xakZZxaKw9qtgMoRvDd5Z 6+f/jPaq728ai3EIz325z9w0aGH8zCBghznkhdrphdZvOlkPBMQevNxHsVADoIqngdF5 wZUdR4A7ZRYpjIv7dm0Gukvxk6AfW1e153Ets= MIME-Version: 1.0 Received: by 10.224.26.231 with SMTP id f39mr269737qac.56.1276051473312; Tue, 08 Jun 2010 19:44:33 -0700 (PDT) Received: by 10.229.95.78 with HTTP; Tue, 8 Jun 2010 19:44:33 -0700 (PDT) In-Reply-To: References: Date: Wed, 9 Jun 2010 10:44:33 +0800 Message-ID: Subject: Re: PhantomReference in Cassandra From: Anty To: dev@cassandra.apache.org Content-Type: multipart/alternative; boundary=00c09f99e638c8301c04888fe2c8 X-Virus-Checked: Checked by ClamAV on apache.org --00c09f99e638c8301c04888fe2c8 Content-Type: text/plain; charset=ISO-8859-1 In theory ,it could do some help. On Sat, Jun 5, 2010 at 9:10 PM, Jonathan Ellis 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 wrote: > > ---------- Forwarded message ---------- > > From: Anty > > Date: Sat, Jun 5, 2010 at 4:30 PM > > Subject: PhantomReference in Cassandra > > To: user@cassandra.apache.org, chukwa-dev > > > > > > Hi:All > > in the code of SSTableReader.java > > private static final ReferenceQueue finalizerQueue = new > > ReferenceQueue() > > {{ > > 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 --00c09f99e638c8301c04888fe2c8--