We should try to save all pages even if 1 fails. So the current code looks fine

On 4/2/08, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:
> Or could list.clear() be done in a finally block? Of a try
> block going over the whole loop.
>
> On Tue, 01 Apr 2008, [EMAIL PROTECTED] wrote:
>
> > Author: knopp
> > Date: Tue Apr  1 06:52:21 2008
> > New Revision: 643400
> >
> > URL: http://svn.apache.org/viewvc?rev=643400&view=rev
> > Log:
> > WICKET-1470
> >
> > Modified:
> >
> wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
> >
> > Modified:
> wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
> > URL:
> http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java?rev=643400&r1=643399&r2=643400&view=diff
> >
> ==============================================================================
> > ---
> wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
> (original)
> > +++
> wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
> Tue Apr  1 06:52:21 2008
> > @@ -885,8 +885,14 @@
> >             {
> >                     for (Iterator i = list.iterator(); i.hasNext();)
> >                     {
> > -                           SerializedPage page = (SerializedPage)i.next();
> > -                           getSessionEntry(sessionId, true).savePage(page);
> > +                           try {
> > +                                   SerializedPage page = 
> > (SerializedPage)i.next();
> > +                                   getSessionEntry(sessionId, 
> > true).savePage(page);
> > +                           } catch (Exception e) {
> > +                                   // We have to catch the exception here 
> > to process the other entries,
> > +                                   // otherwise there would be a big 
> > memory leak
> > +                                   log.error("Error flushing page", e);
> > +                           }
> >                     }
> >                     list.clear();
> >             }
> >
> >
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>

Reply via email to