Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-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 D79638B11 for ; Tue, 16 Aug 2011 17:14:45 +0000 (UTC) Received: (qmail 21954 invoked by uid 500); 16 Aug 2011 17:14:45 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 21798 invoked by uid 500); 16 Aug 2011 17:14:44 -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 21790 invoked by uid 99); 16 Aug 2011 17:14:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 17:14:44 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.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; Tue, 16 Aug 2011 17:14:37 +0000 Received: by server.dankulp.com (Postfix, from userid 5000) id 160CD183E11; Tue, 16 Aug 2011 13:14:17 -0400 (EDT) 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.g1socsK8q3 Received: from dilbert.dankulp.com (c-24-91-72-253.hsd1.ma.comcast.net [24.91.72.253]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.dankulp.com (Postfix) with ESMTPSA id 1E09A183E0D; Tue, 16 Aug 2011 13:14:16 -0400 (EDT) From: Daniel Kulp To: dev@cxf.apache.org Cc: Aki Yoshida Subject: Re: best practice for setting order constraints among interceptors Date: Tue, 16 Aug 2011 13:14:14 -0400 Message-ID: <1446809.7tvjxkcG3q@dilbert.dankulp.com> User-Agent: KMail/4.7.0 (Linux/3.0.0; KDE/4.7.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 For the most part, I don't think it really matters. There used to be some performance issues adding interceptors that had a bunch of befores and afters, but those were pretty much resolved. Also, with the chain caching we do, such interceptors aren't added very ofter. THAT said, if you start seeing a lot of interceptors with a bunch of addBefore/Afters, etc... that may be a good indication that we should split the phase into two phases. The PRE_PROTOCOL phase got really bad at one point and for 2.4, we split it to ease the issues. With the number of interceptors in PRE_STREAM, that may be a good indication that we should add a phase in there. Maybe add a TRANSFORM_STREAM phase where StaxOut and others that "transform" the stream from InputStream type things to XMLStreamWriter things would live. (FIStax, TransformOut, etc....) Dan On Tuesday, August 16, 2011 6:51:19 PM Aki Yoshida wrote: > Hi, > If you have two interceptors A and B that go into the same phase and > additionally you want to make sure A must precede B, you can either > write > addBefore(B) in A's constructor > or > addAfter(A) in B's constructor. > > But is there a good rule for deciding which one to choose? > > The concrete case that I have is for LoggingOutInterceptor and > TransformOutInterceptor. > They both go into PRE_STREAM.. > > LoggingOI should wrap the output stream before anyone start using it, > so it must precede any Stax based interceptors. That means we have the > order: > LoggingOI < TransformOI < StaxOI > > Initially, I added this constraint in the constructor of TransformOI > as I was fixing another issue of this class. > addBefore(StaxOI) > addAfter(LoggingOI). > > But later I thought, it might have been more readable to put this > constraint in the LoggingOI as > addBefore(StaxOI) > addBefore(TransformOI). > to indicate LoggingOI must precede any known Stax based interceptors. > > Maybe, this is a stupid question. But if someone has a strong opinion > in one way or the other. I am interested in hearing it. > > Thanks. > > regards, aki -- Daniel Kulp dkulp@apache.org http://dankulp.com/blog Talend - http://www.talend.com