Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 67582 invoked from network); 17 Jun 2009 14:30:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jun 2009 14:30:57 -0000 Received: (qmail 6405 invoked by uid 500); 17 Jun 2009 14:31:07 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 6299 invoked by uid 500); 17 Jun 2009 14:31:06 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 6246 invoked by uid 99); 17 Jun 2009 14:31:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 14:31:06 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rene.glanzer@gmail.com designates 209.85.218.213 as permitted sender) Received: from [209.85.218.213] (HELO mail-bw0-f213.google.com) (209.85.218.213) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 14:30:56 +0000 Received: by bwz9 with SMTP id 9so585265bwz.42 for ; Wed, 17 Jun 2009 07:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=OIz+HW8vT0anVB41ZE9xsYVNwZ2umJZv50HBaXlPskk=; b=fS9HPmUcPSntGAzWNu4VklVsO2R29MqnneaMFMPwv6h0LQpiF3df1b6C5OMCHhb8Gx A/AsN9Db0CHY1PFojvKdBA5g42H+9pcF2Y61tCVWQsIoQu9KiwMFODKo48DbAtmwvEQ3 gyB36ehGbGZVbQQ2GJP2faPkQLwMwOJAWyJuM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=quNSm41OgZHIfWISLeDTf2aurP0bypzDb7ebM94lERODqEsF00/PvEJA5713s8lFhP KX+aJfKqsXpHpI8FiKbsf0dYBOHWqpR4foJ22LmddCX8NVaYvmv0H6Yr7jTsOKquLKjD 2zIWHtZWOE+Q/jE2GQpVOfJsaPgJ6cpy4J3kc= MIME-Version: 1.0 Received: by 10.204.77.78 with SMTP id f14mr202120bkk.76.1245249035742; Wed, 17 Jun 2009 07:30:35 -0700 (PDT) In-Reply-To: References: <4fc6b7820906090933tf707810xce8470c2614784cd@mail.gmail.com> <139558.17721.qm@web50302.mail.re2.yahoo.com> <4fc6b7820906170047i6b383a0s7929591a6408db61@mail.gmail.com> <4fc6b7820906170248j7951deejc4503a9d20e59e86@mail.gmail.com> <4fc6b7820906170427r1e984235w1dac6b87c1d5fb98@mail.gmail.com> <4fc6b7820906170707y5201c9bbp58861b42d0648fb4@mail.gmail.com> <327858f40906170717y4aa6664o23217c887f517c42@mail.gmail.com> Date: Wed, 17 Jun 2009 16:30:35 +0200 Message-ID: <4fc6b7820906170730v5a2ac91fl4b99135ffaa292e0@mail.gmail.com> Subject: Re: [collections] LRUMap Problem ConcurrentModificationException From: =?ISO-8859-1?Q?Ren=E8_Glanzer?= To: Commons Users List Content-Type: multipart/alternative; boundary=001485f794706eae79046c8c224b X-Virus-Checked: Checked by ClamAV on apache.org --001485f794706eae79046c8c224b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I was searching for a very lighweight cache systems with not much overhead for my purposes. The LRUMap just matched perfectly except the little iterator problem. 2009/6/17 James Carman > Or, ehcache or oscache or something like that? > > On Wed, Jun 17, 2009 at 10:17 AM, Leon > Rosenberg wrote: > > why don't you just use softreference + expiration timestamp and save > > all the trouble? > > Leon > > > > On Wed, Jun 17, 2009 at 4:07 PM, Ren=E8 Glanzer > wrote: > >> Hi, > >> > >> it's me again with an update. > >> the LRUMap.mapIterator() still produces the > >> ConcurrentModificationException when a call to MapIterator.remove() > >> occurs. > >> > >> Maybe this info helps > >> Ren=E9 > >> > >> > >> 2009/6/17 Ren=E8 Glanzer : > >>> Hi J=F6rg, > >>> > >>> it's me again. With a smile on my face :-) > >>> > >>> I changed my code according to your hint. > >>> Now i don't use the keySet but the entrySet. With only to adopt the > rest of > >>> the method to the entrySet and still > >>> calling the remove() method of the iterator in my tests no > >>> ConcurrentModificationException occured!! > >>> > >>> Additionally now I'm using the LURMap.mapIterator() which also perfor= ms > well > >>> and according to the docu should be prefered over the entrySet or > keySet. > >>> > >>> Now the new an well working code looks like this: > >>> > >>> public void removeAllExpiredItems() > >>> { > >>> synchronized(this.store) > >>> { > >>> MapIterator it=3Dthis.store.mapIterator(); //Here I'm using the= new > >>> MapIterator > >>> while(it.hasNext()) > >>> { > >>> m_catLog.debug("Reading object"); > >>> Object key=3Dit.next(); > >>> Item currentItem=3D(Item)it.getValue(); > >>> if(currentItem.birth=3D=3D0) > >>> { > >>> m_catLog.debug("0 birth found for key "+key+" calling > >>> Iterator.remove"); > >>> it.remove(); > >>> } > >>> } > >>> this.setLastCleanDate(new Date()); > >>> } > >>> } > >>> > >>> Thousand Thanks for your help J=F6rg > >>> this fixed my Problem and maybe also fixes the problems from the othe= r > >>> people who suffered the same problem. > >>> Furthermore I'm pleased to see that the JIRA issue COLLECTION-330 is > >>> handling the problem with the keySet call. > >>> > >>> 2009/6/17 J=F6rg Schaible > >>>> > >>>> Ren=E8 Glanzer wrote at Mittwoch, 17. Juni 2009 11:48: > >>>> > >>>> > Hi J=F6rg, > >>>> > > >>>> > that are great news, I'll give it a try. > >>>> > And of course I'll report my experience. > >>>> > >>>> That would be fine. Actually I opened an own JIRA issue for this now > >>>> (COLLECTION-330), COLLECTION-3 was simply too vague and had a too lo= ng > >>>> history of different symptoms. > >>>> > >>>> - J=F6rg > >>>> > >>>> > >>>> --------------------------------------------------------------------= - > >>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >>>> For additional commands, e-mail: user-help@commons.apache.org > >>>> > >>> > >>> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >> For additional commands, e-mail: user-help@commons.apache.org > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --001485f794706eae79046c8c224b--