Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13804DC26 for ; Tue, 13 Nov 2012 01:08:51 +0000 (UTC) Received: (qmail 4848 invoked by uid 500); 13 Nov 2012 01:08:50 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 4781 invoked by uid 500); 13 Nov 2012 01:08:50 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 4771 invoked by uid 99); 13 Nov 2012 01:08:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Nov 2012 01:08:50 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of knst.kolinko@gmail.com designates 209.85.220.173 as permitted sender) Received: from [209.85.220.173] (HELO mail-vc0-f173.google.com) (209.85.220.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Nov 2012 01:08:42 +0000 Received: by mail-vc0-f173.google.com with SMTP id fl15so9090245vcb.18 for ; Mon, 12 Nov 2012 17:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=X3Qi55Kq/CR8MP3zD6DD9R4cbmaCQgUliYFoxl04wPc=; b=gYHgUzfmduVOF+YnQCRRG0mG8f2zCVqgd2Ba1M/KgxSFDJoW9QxcISV7h5v52PYZGx xM+fshUGjRdY2cjNRw0mrI/xU7ydxlQvmeXZ8V6FEsqOkiYe02bLdoXc7L4H4XdeSOzw z7fKEeFpG36vhB3uDQZyIfgwgHRzPoKwy3R/aAaoMO4XhcmRSQw/zz31fAFjkWBN0hNR AAyNmqtI8pua3JgoJR2ncbkv49/jT+ZRtI7LcnopvAHEddhqbRGnqgEifF02EURuZTbA /Kp+cwoB7WPfi6Gjs6lvEdBUvL5xts/hMn5VTmZMRzzDzMYtc7i0wU3ys/fsMtLVQNO0 BNnA== MIME-Version: 1.0 Received: by 10.58.161.113 with SMTP id xr17mr23889710veb.3.1352768901295; Mon, 12 Nov 2012 17:08:21 -0800 (PST) Received: by 10.58.249.199 with HTTP; Mon, 12 Nov 2012 17:08:21 -0800 (PST) In-Reply-To: <20121111233244.AF11223888CD@eris.apache.org> References: <20121111233244.AF11223888CD@eris.apache.org> Date: Tue, 13 Nov 2012 05:08:21 +0400 Message-ID: Subject: Re: svn commit: r1408150 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/AsyncContextImpl.java webapps/docs/changelog.xml From: Konstantin Kolinko To: Tomcat Developers List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 2012/11/12 : > Author: markt > Date: Sun Nov 11 23:32:43 2012 > New Revision: 1408150 > > URL: http://svn.apache.org/viewvc?rev=1408150&view=rev > Log: > both timeout and complete, as with all container callbacks must be invoked with the right context > Backport of fhanik's r1356898 1. The change only takes care of timeout(). What about complete (fireOnComplete()) that is mentioned in the commit message and in the changelog? 2. I wonder what about running with SecurityManager. (Well, timeout() is probably called by Tomcat code, so there might be no concern, or maybe you will notice it while running TCK). There is already ready-to-use class AsyncContextImpl$PrivilegedSetTccl(..). Best regards, Konstantin Kolinko > > Modified: > tomcat/tc7.0.x/trunk/ (props changed) > tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java > tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml > > Propchange: tomcat/tc7.0.x/trunk/ > ------------------------------------------------------------------------------ > Merged /tomcat/trunk:r1356898 > > Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java > URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1408150&r1=1408149&r2=1408150&view=diff > ============================================================================== > --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original) > +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Sun Nov 11 23:32:43 2012 > @@ -110,21 +110,30 @@ public class AsyncContextImpl implements > request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); > > if (result.get()) { > - boolean listenerInvoked = false; > - List listenersCopy = > - new ArrayList(); > - listenersCopy.addAll(listeners); > - for (AsyncListenerWrapper listener : listenersCopy) { > - listener.fireOnTimeout(event); > - listenerInvoked = true; > - } > - if (listenerInvoked) { > - request.getCoyoteRequest().action( > - ActionCode.ASYNC_IS_TIMINGOUT, result); > - return !result.get(); > - } else { > - // No listeners, container calls complete > - complete(); > + > + ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); > + ClassLoader newCL = request.getContext().getLoader().getClassLoader(); > + try { > + Thread.currentThread().setContextClassLoader(newCL); > + boolean listenerInvoked = false; > + List listenersCopy = > + new ArrayList(); > + listenersCopy.addAll(listeners); > + for (AsyncListenerWrapper listener : listenersCopy) { > + listener.fireOnTimeout(event); > + listenerInvoked = true; > + } > + if (listenerInvoked) { > + request.getCoyoteRequest().action( > + ActionCode.ASYNC_IS_TIMINGOUT, result); > + return !result.get(); > + } else { > + // No listeners, container calls complete > + complete(); > + } > + > + } finally { > + Thread.currentThread().setContextClassLoader(oldCL); > } > } > return true; > > Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml > URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1408150&r1=1408149&r2=1408150&view=diff > ============================================================================== > --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) > +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Nov 11 23:32:43 2012 > @@ -118,6 +118,11 @@ > In FormAuthenticator: If it is configured to change Session IDs, > do the change before displaying the login form. (kkolinko) > > + > + Ensure AsyncListener.timeout() and > + AsyncListener.complete() are called with the correct > + thread context class loader. (fhanik) > + > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org