Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 65791 invoked from network); 28 Dec 2005 13:47:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Dec 2005 13:47:53 -0000 Received: (qmail 72406 invoked by uid 500); 28 Dec 2005 13:47:53 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 72172 invoked by uid 500); 28 Dec 2005 13:47:52 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 72161 invoked by uid 99); 28 Dec 2005 13:47:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2005 05:47:51 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mrchrisallen@gmail.com designates 64.233.184.206 as permitted sender) Received: from [64.233.184.206] (HELO wproxy.gmail.com) (64.233.184.206) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2005 05:47:51 -0800 Received: by wproxy.gmail.com with SMTP id i28so526774wra for ; Wed, 28 Dec 2005 05:47:30 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VpF0yZojrc7jOXGMsNGwZODod8TKGgFF0BGpx3i7Ge7xkNh8iOJBKmmB2PsEToQcno73HKxLXUvFx30CzdB3wKMKaAtRUWrOI1uIzjHcpEJ3tVQkKVwi+FlKZn1QYWnlCzdcGfLOTm4+1FiAR6oUlU8DwGrJks4pCYgvhHzqwB0= Received: by 10.54.143.5 with SMTP id q5mr957598wrd; Wed, 28 Dec 2005 05:47:30 -0800 (PST) Received: by 10.54.71.6 with HTTP; Wed, 28 Dec 2005 05:47:30 -0800 (PST) Message-ID: Date: Wed, 28 Dec 2005 08:47:30 -0500 From: Chris Allen To: Apache Directory Developers List , jvermillard@archean.fr Subject: Re: [MINA] ReconnectFilter In-Reply-To: <1135760094.4220.2.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1135700198.4195.2.camel@localhost.localdomain> <1135760094.4220.2.camel@localhost.localdomain> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Yeah, that is cool. Sometimes you just have to get it done. I hear ya. ;-= ) Anyway, it's working well for me. I did have some trouble integrating it with Spring, as I needed reference to my IoConnection before it was setup and passing this filter into the Application context at start up caused a circular reference error. I ended up handling it by making the ReconnectionFilter implement Spring's ApplicationContectAware interface and getting the IoConnection bean only when the closed connection event was triggered. I don't particularly like having this class know about Spring, and also have\ing to know what I named the IoConnection bean, but I couldn't think of a better solution at the time. If anyone has any other suggestions let me know. I'm also planning on adding a limit to the amount of times that the filter tries to reconnect, just in case the server it's trying to establish the connection with really is down. -Chris On 12/28/05, Julien Vermillard wrote: > Yes you are right, but I use it that way : > > session.getFilterChain().addLast("reconnection",new > ReconnectionFilter(2000,connector,ATMess.this,session.getRemoteAddress(),= session.getLocalAddress())); > > It was a lazy solution for postponing implemention all the constructor := ) > > Julien > > Le mardi 27 d=E9cembre 2005 =E0 12:35 -0500, Chris Allen a =E9crit : > > > Hi Julien, > > After writing the last email and doing a little more research, I guess t= he > thing to do to make your ReconnectionFilter as flexible as possible, woul= d > be to allow each of the IoConnector.connect() methods to work with this > class. As you can see in the MINA JavaDocs: > http://directory.apache.org/subprojects/network/apidocs/org/apache/mina/c= ommon/IoConnector.html > there are four different versions of connect() and the filter currently o= nly > supports one of them. > > The easiest way that I can see to accomplish this is to provide multiple > constructors for the ReconnectionFilter class that account for each of th= ese > connection methods. I've currently added my own with the single > SocketAddress, but for a truly flexible filter I guess it would have to > support the others as well. > > Anyway, I know this is a work in progress, but I just thought that I sho= uld > mention it, even though it's super obvious. > > Thanks again for letting me know where to find this class, and for creat= ing > it in the first place. > > -Chris