Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1D3DF200B6D for ; Tue, 23 Aug 2016 19:18:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1BBBD160AAD; Tue, 23 Aug 2016 17:18:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3962F160A81 for ; Tue, 23 Aug 2016 19:18:03 +0200 (CEST) Received: (qmail 84146 invoked by uid 500); 23 Aug 2016 17:18:02 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 84127 invoked by uid 99); 23 Aug 2016 17:18:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Aug 2016 17:18:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 86460C1766 for ; Tue, 23 Aug 2016 17:18:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 9-2QY4uJuZ_3 for ; Tue, 23 Aug 2016 17:17:59 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 442CE5F1AE for ; Tue, 23 Aug 2016 17:17:59 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id l89so105707650lfi.1 for ; Tue, 23 Aug 2016 10:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=8nLRQ8i/IUaegqCNSjVBxcBwVeaMrwXw+7KUNGIOMII=; b=tTgqST9JW5tC2+xl2PnDMzlJbJXS5nyh1KyePS/1m4xoMEwQaywBOvc/LH9ZF4AR7A bdJ2hchIBuHumElO4Z117yTtaqvb7Q82cAelYFeGzAgc7e70HF0Hj5J7zVmgKztWdn9i p/+dz8mzgZViJgLxXtybdlQ4qiQOtAESJjxQoMqi/xoOpotS6xIc2uTJ9ARU6BU/fl0o u2cHuEC/Lld9+6E+FZpajbfHevP5cws26Lzp0DU1G2cTSkyEynUPMnot5kmV3uhEI8kf 48Q4aiLCC2qJegFVbXxX7GEcVAWLHIXaRJ68LRP7Nla+S5SsPYaSa1VkwOJVFThx8z+e q7aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=8nLRQ8i/IUaegqCNSjVBxcBwVeaMrwXw+7KUNGIOMII=; b=JEshuDaOLchIkI1TPxnvjAchMDzcASv5IVmy4oBuminlS7O8ebkMUcgDE73I1fQxjr fwEuQJcDja+QPL/EdZuXYWNBgU5cpj6kqPjYXWo0yRXyGOJ3i+qnvRES0SriCjXMH0Sh yIz7YjMya9BT14/MiawhErV/bLXxQgJPEJbLt0++ivA289chLabxOlFDTUooTL612PP+ /6syzKi4UItgpH5Cn6gNzljOCsdm+XQw2IbXl/aLMR+jhOy+5Vtdfa1idg+kpJeVzfyN NcgZ8DPnHVRbeYYWXC8rhop1va9F35fdAbPzoX22XUL6rXC5pyIpUha4I2YI551tQowP OEkw== X-Gm-Message-State: AEkooutUEJ3z+X7gG2yeFdG9oKMmr3nOTumg1TM3VAtuYWiTbHMliRDO0DVlWdC5ww0li/LIKULRGQxr8HC+bw== X-Received: by 10.25.18.154 with SMTP id 26mr6217991lfs.186.1471972677962; Tue, 23 Aug 2016 10:17:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.161.134 with HTTP; Tue, 23 Aug 2016 10:17:36 -0700 (PDT) In-Reply-To: <1667555581.946658.1471970988619@mail.yahoo.com> References: <312C96CC-818A-42EA-9D3D-C27E3A1B4810@yahoo.de> <626343671.454311.1471775070602@mail.yahoo.com> <1667555581.946658.1471970988619@mail.yahoo.com> From: Romain Manni-Bucau Date: Tue, 23 Aug 2016 19:17:36 +0200 Message-ID: Subject: Re: PR Merge? To: dev@geronimo.apache.org, Mark Struberg Content-Type: multipart/alternative; boundary=001a113fb3d496d363053ac058d2 archived-at: Tue, 23 Aug 2016 17:18:04 -0000 --001a113fb3d496d363053ac058d2 Content-Type: text/plain; charset=UTF-8 2016-08-23 18:49 GMT+02:00 Mark Struberg : > No it's not _that_ easy. Simply using a WeakHashMap wont work. You also > have to wrap the value in a WeakReference. Otherwise the value in the Map > will prevent the CL from being garbage collected. A common pitfall I've > seen soooo often implemented the wrong way ;) > > Sounds like a good enough solution to me. JCache impl should be updated as well probably. Who does want to drive this? I'm quite limited in time ATM so happy to let it be done but can help a bit in 1 or 2 weeks if needed. > LieGrue, > strub > > > > > > On Tuesday, 23 August 2016, 17:42, Clebert Suconic < > clebert.suconic@gmail.com> wrote: > > >> Not sure I get you there, commons clearly doesn't take in charge any > of > > that > >> but some containers can force some cleanup (not the other way around) > - at > >> least for beansutils for instance. > > > > With a WeakHashmap, the cache will be removed once the classLoader is > > released, right? Which is what I am trying to achieve here. The cache > > per classLoader. And Removing the classLoader once the references are > > > > released. > > > > > >> > >> Starting with a "leaking" WeakHashMap > Provider> and see if > >> consumers are complaining. > >> > >> It would solve your issue and I can make it working in tomee for > instance > > > > > > Why it would matter? a WeakHashMap won't cause a leak in anyways. The > > ClassLoader is a weak references. Whenever Tomee released the > > classLoader the element would go away from the WeakHashMap. That's how > > weakHashMaps work, and that's the intent. > > > --001a113fb3d496d363053ac058d2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= 2016-08-23 18:49 GMT+02:00 Mark Struberg <struberg@yahoo.de>= :
No it's not _that_ easy. Simply usi= ng a WeakHashMap wont work. You also have to wrap the value in a WeakRefere= nce. Otherwise the value in the Map will prevent the CL from being garbage = collected. A common pitfall I've seen soooo often implemented the wrong= way ;)


Sounds like a good enough solution to = me. JCache impl should be updated as well probably.

Who does want to drive this? I'm quite limited in time ATM so happy t= o let it be done but can help a bit in 1 or 2 weeks if needed.
= =C2=A0
LieGrue,
strub




> On Tuesday, 23 August 2016, 17:42, Clebert Suconic <clebert.suconic@gmail.com> wrote:
> >>=C2=A0 Not sure I get you there, commons clearly doesn't t= ake in charge any of
> that
>>=C2=A0 but some containers can force some cleanup (not the other wa= y around) - at
>>=C2=A0 least for beansutils for instance.
>
> With a WeakHashmap, the cache will be removed once the classLoader is<= br> > released, right? Which is what I am trying to achieve here. The cache<= br> > per classLoader. And Removing the classLoader once the references are<= br> >
> released.
>
>
>>
>>=C2=A0 Starting with a "leaking" WeakHashMap<ClassLoad= er,
> Provider> and see if
>>=C2=A0 consumers are complaining.
>>
>>=C2=A0 It would solve your issue and I can make it working in tomee= for instance
>
>
> Why it would matter? a WeakHashMap won't cause a leak in anyways. = The
> ClassLoader is a weak references. Whenever Tomee released the
> classLoader the element would go away from the WeakHashMap. That's= how
> weakHashMaps work, and that's the intent.
>

--001a113fb3d496d363053ac058d2--