From users-return-21424-apmail-tomee-users-archive=tomee.apache.org@tomee.apache.org Thu Sep 3 14:04:10 2015 Return-Path: X-Original-To: apmail-tomee-users-archive@www.apache.org Delivered-To: apmail-tomee-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 27A46188B5 for ; Thu, 3 Sep 2015 14:04:10 +0000 (UTC) Received: (qmail 76023 invoked by uid 500); 3 Sep 2015 14:04:10 -0000 Delivered-To: apmail-tomee-users-archive@tomee.apache.org Received: (qmail 75997 invoked by uid 500); 3 Sep 2015 14:04:09 -0000 Mailing-List: contact users-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@tomee.apache.org Delivered-To: mailing list users@tomee.apache.org Received: (qmail 75985 invoked by uid 99); 3 Sep 2015 14:04:09 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Sep 2015 14:04:09 +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 3D1E2F12D0 for ; Thu, 3 Sep 2015 14:04:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.214 X-Spam-Level: **** X-Spam-Status: No, score=4.214 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id DxS6hxpWFy1B for ; Thu, 3 Sep 2015 14:03:55 +0000 (UTC) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 838DF21141 for ; Thu, 3 Sep 2015 14:03:54 +0000 (UTC) Received: by lbpo4 with SMTP id o4so24990583lbp.2 for ; Thu, 03 Sep 2015 07:03:54 -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 :content-type; bh=Llm679VgptWN9lyyuJtd5NFd6Q2PwuVwplXCEd+UhOQ=; b=UAHLHaLdKJ7hPNfZfhdzrpB4V1oQhmgztsaya1Dg0I2KNtSWqpy0J+jXc6qdKGH0eI F3WXhISxXeww+C0QC10WF2NX5hpHme62D+ziNGbwpNzfxfyx8TTieUhRyaVozoZe5hsM AJLiIzED9Itv8dE2jGcV0/fWeiHrtIu0tflGNVue6kzPxc8Ew4/IToGkTi8G1vfqNKIM 2QLC/kOviJR8QHT8aYPvWVFmHHJ4BeBOxiWUT/NloYr8Anl2V7rhDcEh/c8dXk2ha28o LiQTI0qrqENjvVOz6ymabVe/Ee/mUB9JLh4bNWgH5g/1WH7WYz9kvK3ltEiiyosAWGoH v4mA== X-Received: by 10.112.51.133 with SMTP id k5mr20965312lbo.107.1441289033979; Thu, 03 Sep 2015 07:03:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.140.37 with HTTP; Thu, 3 Sep 2015 07:03:34 -0700 (PDT) In-Reply-To: References: <1441206601926-4676065.post@n4.nabble.com> <1441262340619-4676072.post@n4.nabble.com> <1441268871515-4676077.post@n4.nabble.com> <1441273755781-4676080.post@n4.nabble.com> <1441286628236-4676086.post@n4.nabble.com> <1441287589150-4676088.post@n4.nabble.com> From: Romain Manni-Bucau Date: Thu, 3 Sep 2015 16:03:34 +0200 Message-ID: Subject: Re: Permgen issue? To: "users@tomee.apache.org" Content-Type: multipart/alternative; boundary=001a11339690e3a2f8051ed8401b --001a11339690e3a2f8051ed8401b Content-Type: text/plain; charset=UTF-8 About the pool itself: on modern tomee version the pool (AsynchronousPool-*) is bound to the app and stopped when undeploying the application waiting max AsynchronousPool.ShutdownWaitDuration . So basically a real undeployment/redeployment should work smoothly. Can you validate it quickly (ie dont use WTP to test it). Our async pool thread have the container classloader as context classloader by default so the thread shouldnt kep track of the classloader and bindings should be resetted properly in the async task. Said otherwise Im trying to check if WTP hot deploy doesnt follow the full lifecycle. Romain Manni-Bucau @rmannibucau | Blog | Github | LinkedIn | Tomitriber 2015-09-03 15:54 GMT+02:00 Romain Manni-Bucau : > ok so 2 cases: > - bug is in tomee when creating the thread -> Ill check it > - bug is due to your task as explained before, for this case you can do > something like: > > @Singleton > public class MyAsyncService { > @Resource SessionContext ctx; > AtomicReference> future = new AtomicReference<>(); > > public Future doIt(){ > future.set(ctx. getBusinessObject(MyAsyncService.class) > .doItAsync()); > System.out.println("Done"); > return null; > } > > @Asynchronous > public void doItAsync(){ > > System.out.println("Doing it async"); > } > > @PreDestoy public void cancel() > {ofNullable(future).map(AtomicReference::get).ifPresent(Future::cancel);} > } > > > > > > Romain Manni-Bucau > @rmannibucau | Blog > | Github > | LinkedIn > | Tomitriber > > > 2015-09-03 15:39 GMT+02:00 tonywestonuk : > >> I am sorry, but I don't really understand how I can kill the task.... >> >> In my example, above, the async task is just a single System.out !! - >> How >> can I kill this, it executes in milliseconds!! >> >> Looking at the threads using VisualVM, I can see the asynchronous thread >> in >> there, but it is marked as completed, and no longer running. there is no >> task to kill.... everything is done! It just needs to be removed from >> the >> ContextBindings to allow the old application to be GC'd. >> >> Or, if i am completely missing the point of what you are telling me, >> please >> feel free to show me how I can make my example MyAsyncService work so the >> app correctly undeploys. >> >> Thank you for helping..... :-D >> >> >> >> -- >> View this message in context: >> http://tomee-openejb.979440.n4.nabble.com/Permgen-issue-tp4676065p4676088.html >> Sent from the TomEE Users mailing list archive at Nabble.com. >> > > --001a11339690e3a2f8051ed8401b--