Return-Path: Delivered-To: apmail-incubator-uima-dev-archive@locus.apache.org Received: (qmail 75596 invoked from network); 21 May 2007 20:23:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2007 20:23:10 -0000 Received: (qmail 82001 invoked by uid 500); 21 May 2007 20:23:16 -0000 Delivered-To: apmail-incubator-uima-dev-archive@incubator.apache.org Received: (qmail 81982 invoked by uid 500); 21 May 2007 20:23:16 -0000 Mailing-List: contact uima-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: uima-dev@incubator.apache.org Delivered-To: mailing list uima-dev@incubator.apache.org Received: (qmail 81969 invoked by uid 99); 21 May 2007 20:23:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 13:23:16 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of eaepstein@gmail.com designates 209.85.132.247 as permitted sender) Received: from [209.85.132.247] (HELO an-out-0708.google.com) (209.85.132.247) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 13:23:08 -0700 Received: by an-out-0708.google.com with SMTP id b33so627786ana for ; Mon, 21 May 2007 13:22:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=T0xyAbk1boiefubk2E7xJZGqH/KddbzbBVlLEVFi8yXOQ4pFEgkCogL7uw7scX4COudJ+B7pFMK/q8uVX4R30v7VcC6B0t51Bqe24JRRR6OLiqoijjFTxSen/Ctrag8vvJmp5rP9sCb3Upebo9/eWG+sU2oEG5F5H+oiiAsFejE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Na1habzZRSCqUxqqDcoGKd9rTF2LK0M/sii0KgR14cxQdOGvoX6n2awhcpUyuCV9H0CHCFsLjSKaBJemVkJAtxJsKtVdHb39L9xLNnMeUTEBRmNEwD4qX5jrMgRu9xu2S6RkcEeIz9BRXqCJCmGw7YbByMLcQWQwGJp4sT6ahCU= Received: by 10.100.141.13 with SMTP id o13mr3302834and.1179778967606; Mon, 21 May 2007 13:22:47 -0700 (PDT) Received: by 10.100.43.19 with HTTP; Mon, 21 May 2007 13:22:47 -0700 (PDT) Message-ID: Date: Mon, 21 May 2007 16:22:47 -0400 From: "Eddie Epstein" To: uima-dev@incubator.apache.org Subject: Re: Eddie - can you check my reasoning on this "bug" in setting the CASImpl sofaRef? In-Reply-To: <4651DE10.9040107@schor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4651DE10.9040107@schor.com> X-Virus-Checked: Checked by ClamAV on apache.org On 5/21/07, Marshall Schor wrote: > The resetNoQuestions iterates over all the views, calling resetView: > > /* > * iterated reset - once per view of a CAS except for the base CAS > */ > private void resetView() { > this.indexRepository.flush(); > if (this.mySofaRef > 0 && this.getSofa().getSofaRef() == 1) { > // indicate no Sofa exists for the initial view > this.mySofaRef = -1; > } else { > this.mySofaRef = 0; > } > > ... > > The logic for resetting this.mySofaRef should be to set it to -1 for the > initial view, and 0 for other cases > The -1 indicates no sofa has been created (lazy creation being done). > > But this logic seems to fail when CAS Pools are being set up because the > pools are created, each CAS having > a base and an "initial View" with the mySofaRef set to -1 for the > initial view. So far, so good. > The pool creation code contains a call to: > > protected void populateCasToCasPoolMap(CasPool aCasPool) { > CAS[] casArray = new CAS[aCasPool.getSize()]; > for (int i = 0; i < casArray.length; i++) { > casArray[i] = ((CASImpl) aCasPool.getCas()).getBaseCAS(); > mCasToCasPoolMap.put(casArray[i], aCasPool); > } > for (int i = 0; i < casArray.length; i++) { > aCasPool.releaseCas(casArray[i]); > } > } > > which just is there to set up a map from the cas to the pool to which it > belongs. It however, works by > checking out each cas, and then releasing them back. The releaseCas > calls "reset" on the CAS. This > causes the above resetView to be called on the initial view, but the > sofa has never been created. So the > bit of logic trying to detect this is the initial sofa, fails, and the > mySofaRef is set to 0. Later when the initial > view is checked out of the pool, the lazy sofa creation mechanism fails > because it requires mySofaRef be -1. > > Note this would fail anytime a CAS initial view was acquired, and reset > called on it prior to doing anything which > would have required that a sofa be created. > > I'm fixing this by having the caller of resetView, which knows > explicitly which sofa is the initial one, handle this > by setting mySofaRef to -1 there. Does this seem right? > > -Marshall > That would work. Or you could just fix resetView() with: if (this.mySofaRef > 0) { if (this.getSofa().getSofaRef() == 1) { // indicate no Sofa exists for the initial view this.mySofaRef = -1; } else { // indicate no Sofa exists this.mySofaRef = 0; } }