Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 35464 invoked from network); 24 Feb 2006 08:21:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Feb 2006 08:21:14 -0000 Received: (qmail 10539 invoked by uid 500); 24 Feb 2006 08:21:13 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 10501 invoked by uid 500); 24 Feb 2006 08:21:13 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 10487 invoked by uid 99); 24 Feb 2006 08:21:13 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 00:21:13 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.43] (HELO brmea-mail-2.sun.com) (192.18.98.43) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 00:21:12 -0800 Received: from phys-gadget-1 ([129.156.85.171]) by brmea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id k1O8Kl8u002326 for ; Fri, 24 Feb 2006 01:20:47 -0700 (MST) Received: from conversion-daemon.gadget-mail1.uk.sun.com by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IV600001N27W7@gadget-mail1.uk.sun.com> (original mail from Knut.Hatlen@Sun.COM) for derby-dev@db.apache.org; Fri, 24 Feb 2006 08:20:47 +0000 (GMT) Received: from khepri19 (khepri19.Norway.Sun.COM [129.159.112.231]) by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IV6003G4N6KQE@gadget-mail1.uk.sun.com> for derby-dev@db.apache.org; Fri, 24 Feb 2006 08:20:47 +0000 (GMT) Date: Fri, 24 Feb 2006 09:20:44 +0100 From: Knut Anders Hatlen Subject: Re: [DRDA] Question about DRDAStatement.initialize() method In-reply-to: <58ed70f50602231615q28eb7d70obd05d43cb5261a64@mail.gmail.com> To: derby-dev@db.apache.org Message-id: Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=us-ascii User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/22.0.50 (usg-unix-v) References: <58ed70f50602231411h2c33db9egf30a7590c793b690@mail.gmail.com> <43FE3CBB.3030600@sbcglobal.net> <87y801tz1v.fsf@sun.com> <58ed70f50602231615q28eb7d70obd05d43cb5261a64@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Deepa Remesh writes: > Thanks Knut and Kathey. I will open a jira issue for changing use of > initialize or do it in a separate patch. For your answers to > question3, I have a small concern. Please see below. > > >> >>3. Is my comment for the new reuse method() okay? specifically, the >> >>comment about fields which should not be reset? >> >>"This method should reset all members of this class except the >> >>following which will be set at initial creation or set explicitly in >> >>the code: database, pkgnamcsn, pkgcnstkn, pkgid, pkgsn" >> >> >> >> >> >> >> > If these can be reset too that would be good and then get set whereever >> > the get set just for completeness. >> >> If you reset these variables, you'll need to call >> DRDAStatement.setPkgnamcsn() and DRDAStatement.setDatabase() later. In >> DRDAConnThread, setPkgnamcsn() and setDatabase() are not called after >> DRDAStatement.initialize(), so you'll have to add those calls there. > > pkgnamcsn is the key used for statements added to stmtTable. It seems > to the basis for reusing statements. Resetting it seems a bit odd to > me. Code in Database.newDRDAStatement will look like this: > > DRDAStatement stmt = getDRDAStatement(pkgnamcsn); > if (stmt != null) { > stmt.reset(); > stmt.setPkgnamcsn(pkgnamcsn); > stmt.setDatabase(this); > } I agree, it's odd. The way DRDAStatements are reused, pkgnamcsn and database rarely (if ever) have to be touched. I think it's OK not to reset them. You might also consider getting rid of pkgcnstkn, pkgid and pkgsn since they are stored in pkgnamcsn anyway. If you remove them, we only have two variables that aren't reset like the others. I also think it's a good idea to add a comment before the declarations of the instance variables saying something like // NOTE! // // Since DRDAStatements are reused, ALL variables (except 'database' // and 'pkgnamcsn') should be set to their default values in // reset(). -- Knut Anders