I didn't propose that completely i think about doing this

                        Thread t = (Thread)usedSession.get(this);  // See now 'this' instead of the page id
                        while (t != null && t != Thread.currentThread())
                        {
                                try
                                {
                                        wait(1000);
                                }
                                catch (InterruptedException ex)
                                {
                                        throw new WicketRuntimeException(ex);
                                }
                                t = (Thread)usedPages.get(this);
                        }
                        usedPages.put(this, Thread.currentThread());


and then

        final synchronized void requestDetached()
        {
                usedPages.remove(this);
                notifyAll();
        }


And that requestDetached() is always called (in the finally of RequestCycle or something like that)

The drawback is that it is not that finer grained as we used to have Just a page id
but every page request will block all other page requests... And this is a problem with frames...

maybe there is something in between we could say do the barrier on the pagemap.

But this all is just to make it a bit better.So that we could get rid of the session lock in RequestCycle
and make sure one request is only doing one or more pages (then blocking on the pagemap would help)

The quick fix for now is this: keep the current code in getPage()
but pageDetached will still become requestDetached()

and that does this:

usedPage.entrySet().iterator()
Entry entry = xxxxx
if(entry.value == Thread.currentThread())
{
   iterator.remove();
}

then everything the current thread holds is removed.

johan










On 9/8/06, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
Yes smartass, of course. That's why the wait (on session) is there.
However, if you look at this:

                        Thread t = (Thread)usedPages.get(id);
                        while (t != null && t != Thread.currentThread())
                        {
                                try
                                {
                                        wait(1000);
                                }
                                catch (InterruptedException ex)
                                {
                                        throw new WicketRuntimeException(ex);
                                }
                                t = (Thread)usedPages.get(id);
                        }
                         usedPages.put(id, Thread.currentThread());

and

        final synchronized void pageDetached(Page page)
        {
                usedPages.remove(page.getId());
                notifyAll();
        }

I believe that because of the above method Johan proposes

        final synchronized void pageDetached(Page page)
        {
                usedPages.clear();
                notifyAll();
        }

But that would have the effect that syncing would only work for the
first thread, but a second and third thread would would be a problem,
right?

Or do you propose something else, Johan?

Eelco

On 9/8/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> you cant have two threads working on a page - thats the whole point of
> syncing :)
>
> -Igor
>
>
>
> On 9/8/06, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
> >
> But if you have two threads working on that page, the first thread to
> end would also remove the page reference for the second?
>
> Eelco
>
>
> On 9/8/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
> > Thx,
> > Currently we release the pages only at the end of the request anyway. So
> > what we can do
> > is just remove everything out of the used map for the current thread
> always
> > after the request
> > and call notify all..
> >
> >  Then it should always be cleanup.
> >
> > johan
> >
> >
> >
> > On 9/8/06, Eelco Hillenius < [EMAIL PROTECTED] > wrote:
> > > I get how that happens now. Thanks for tracing and explaining. Nasty
> > > one. I opened up a bug
> > >
> >
> http://sourceforge.net/tracker/index.php?func=detail&aid=1554508&group_id=119783&atid=684975
> > > and assigned it to Johan to look at if he has some spare time.
> > >
> > > Eelco
> > >
> > > On 9/7/06, Iman Rahmatizadeh <[EMAIL PROTECTED] > wrote:
> > > > Well here's a trace of what happens that causes the problem :
> > > > During the RESOLVE_TARGET step of RequestCycle, the target is trying
> to
> > > > be resolved using the
> > DefaultRequestTargetResolverStrategy, which first
> > > > inside the resolveRenderedPage() method uses Session.getPage () to get
> > > > the page,(which adds it to the usedPages map,a hidden side-effect
> > > > imho),and then calls resolveListenerInterfaceTarget()
> > where it retrieves
> > > > the Component for the path and calls isVisibleInHierarchy() on it.
> This
> > > > method throws an exception in my application, which is caught back in
> > > > the RequestCycle. Now, the target didn't have a chance to be added to
> > > > requestTargets, but the page has been added to the usedPages. In the
> > > > detach phase, the requestTargets are detached one by one, which in
> this
> > > > case is only the exception page generated. So when i push back and
> click
> > > > on another link with the same page id, it'll fall into the loop
> > > > mentioned, cause the thread hasn't been cleared. I guess this somehow
> > > > means a problem with the usedPages map, where it should be cleared on
> an
> > > > exception.
> > > >
> > > > Iman
> > > >
> > > >
> >
> -------------------------------------------------------------------------
> > > > Using Tomcat but need to do more? Need to support web services,
> > security?
> > > > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > > >
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > > _______________________________________________
> > > > Wicket-user mailing list
> > > > Wicket-user@lists.sourceforge.net
>  > > >
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > >
> > >
> >
> -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services,
> security?
> > > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > >
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> >
> -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
> >
>
> -------------------------------------------------------------------------
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to