Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 67836 invoked from network); 29 Nov 2010 19:05:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Nov 2010 19:05:18 -0000 Received: (qmail 83443 invoked by uid 500); 29 Nov 2010 19:05:17 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 83300 invoked by uid 500); 29 Nov 2010 19:05:17 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 83292 invoked by uid 99); 29 Nov 2010 19:05:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 19:05:17 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.85.173.253] (HELO server.dankulp.com) (64.85.173.253) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 19:05:09 +0000 Received: by server.dankulp.com (Postfix, from userid 5000) id A226A1871B1; Mon, 29 Nov 2010 14:04:48 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on server.dankulp.com X-Spam-Level: X-Msg-File: /tmp/mailfilter-dev@cxf.apache.org.sZqVhgkPLI Received: from dilbert.dankulp.com (c-24-91-72-253.hsd1.ma.comcast.net [24.91.72.253]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.dankulp.com (Postfix) with ESMTPSA id 94D361871B1; Mon, 29 Nov 2010 14:04:47 -0500 (EST) From: Daniel Kulp To: dev@cxf.apache.org Subject: Re: Holding bus references Date: Mon, 29 Nov 2010 14:04:51 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.36; KDE/4.5.3; x86_64; ; ) Cc: Benson Margulies References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201011291404.51380.dkulp@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-102.9 required=3.0 tests=ALL_TRUSTED,BAYES_00, SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.1 On Thursday 25 November 2010 11:39:07 am Benson Margulies wrote: > I bet that Dan is his usual overtaxed self, but I'm restarting this > thread to attract his attention, since I fear that I've dug us into a > whole. > > The idea of a default, or thread default, bus in CXF is modelled, in > some respects, on the thread context class loader. However, there's > one big difference. > > A thread has no context class loader until some gives it one. (The > initial thread gets one if you are launched from the java command). > > So, since some piece of code has to take explicit action to put a > reference to a class loader in there, no one can claim to be surprised > if that class loader is protected from GC for the life of the thread > or until someone takes the reference back out. > > Our situation, unfortunately, is more complex, insofar as busses > become default in some rather unpredictable ways. The CXFBusImpl > constructors and the CXFBusFactory call the all-too-accurately named > 'perhapsSetDefaultBus'. > > This seems to me to blow up the distinction I tried to draw in recent > email between implicit and explicit busses. Some piece of code uses > one of them to create an 'interesting' bus. If we hold a hard > reference, then that bus might amount to a memory leak. If we hold a > soft reference, that bus might evaporate out from under them, leading > to a surprise. > > This seems to me to leave us with two choices. (1) undo what I did, > and replace it with a lot of documentation warning people that they > need to be careful to call setDefaultBus(null) or > setThreadDefaultBus(null) to turn off leaks. > > (2) remove the setting of a default bus from the two mechanisms above. > If someone wants to create a bus for themselves, and use it as a > default (as opposed to passing it into the API), they should tell us > so explicitly (via extra booleans in that API). If they don't *ask* > for a default, the default remains null. > > This is fairly conspicuous in the incompatibility dept, all to save > having to tell people to make one or two calls to ensure that CXF > isn't holding a default bus reference that they don't want. So I'm > leaning to (1), but I'd like to hear from Dan and any other concerned > parties. Honestly, I'm kind of leaning toward #1 as well. If we find places where we are "leaking" things (like in the maven plugins or tooling), we should definitely fix those cases to make sure anything gets set gets unset. -- Daniel Kulp dkulp@apache.org http://dankulp.com/blog