Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 72438 invoked from network); 15 Apr 2004 14:02:27 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 15 Apr 2004 14:02:27 -0000 Received: (qmail 43069 invoked by uid 500); 15 Apr 2004 14:02:14 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 43031 invoked by uid 500); 15 Apr 2004 14:02:14 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 42982 invoked from network); 15 Apr 2004 14:02:13 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 15 Apr 2004 14:02:13 -0000 Received: (qmail 72299 invoked from network); 15 Apr 2004 14:02:17 -0000 Received: from localhost.hyperreal.org (HELO apache.org) (127.0.0.1) by localhost.hyperreal.org with SMTP; 15 Apr 2004 14:02:17 -0000 Message-ID: <407E95E1.5020400@apache.org> Date: Thu, 15 Apr 2004 16:02:09 +0200 From: Armin Waibel User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: [PATCH] Replace closed connection in ConnectionManagerImpl References: <407E91F9.4030902@gmx.at> In-Reply-To: <407E91F9.4030902@gmx.at> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: localhost.hyperreal.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, Lorenz Froihofer wrote: > Hi, > > >> > >> It allows to replace closed connections if there is no transaction > >> running. Without this patch closed connections are never replaced in > >> ConnectionManagerImpl. > >> > > > >hmm, why do we need this? How can the ConnectionManager hold a closed > >connection? OJB classes itself never close a connection, expect in > >ConnectionFactory impl classes. > >Can you explain why you/we need this. > > I use OJB with a standalone application. The ConnectionManagerImpl never > releases the connection. I assume you never close the used PB instance after use. The used connection was "closed" (means returned to ConnectionFactory implementation) on PB.commitTransaction/rollbackTransaction/close. So if you do a read-only operation and do not close the used PB instance than the connection was NOT released. If you don't want to close the used PB instance, you can use PB.serviceConnectionManager#releaseConnection to "close" the connection. But I recommend to close the PB instance after use (PB instances are pooled too, so this shouldn't be a performance issue). > If I restart the MySQL database server but keep > the application running, the existing connection is unusable thereafter. This should be handled by the ConnectionFactory implementation. If you want do additional checks extend one of the ConnectionFactory implemetnations. > The only option is to restart the application, which is not what I want. > > So I thought it might be a good idea to provide a mechanism to detect > closed (or unusable) connections. As said above this should be done in ConnectionFactory implementation. regards, Armin > This allows to keep applications > running even if the database server is restartet. Sometimes database > connections are simply lost without even restarting the database server > -- yes, this happens. > > Kind regards, > Lorenz. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org