You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Nelis Bijl <Ne...@redwood.nl> on 2001/07/09 15:30:18 UTC

No need for enumerating childs of leaves of a PROPFIND request

Hi,

I propose the following change in executeRequest in PropFindMethod.java:

...
                   if (depth > 0) // proposed change
                   {
                      // existing code
                     Enumeration enum = null;

                     try {
                         enum = structure.getChildren(slideToken, cur);
                     } catch (StructureException e) {
                         e.printStackTrace();
                         
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                         throw new WebdavException
                             (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                     } catch (ServiceAccessException e) {
                         e.printStackTrace();
                         
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                         throw new WebdavException
                             (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                     }

                     while (enum.hasMoreElements()) {
                         stackBelow.push(enum.nextElement());
                     }
                   }
...

While the child information of the leaves is not used, there is no need 
to query it. Please correct me if I am wrong.
In my case the number of queries to be executed on the database reduces 
dramatically.

Regards, Nelis


Re: No need for enumerating childs of leaves of a PROPFIND request

Posted by Remy Maucherat <re...@apache.org>.
> Hi,
>
> I propose the following change in executeRequest in PropFindMethod.java:
>
> ...
>                    if (depth > 0) // proposed change
>                    {
>                       // existing code
>                      Enumeration enum = null;
>
>                      try {
>                          enum = structure.getChildren(slideToken, cur);
>                      } catch (StructureException e) {
>                          e.printStackTrace();
>
> resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
>                          throw new WebdavException
>                              (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
>                      } catch (ServiceAccessException e) {
>                          e.printStackTrace();
>
> resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
>                          throw new WebdavException
>                              (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
>                      }
>
>                      while (enum.hasMoreElements()) {
>                          stackBelow.push(enum.nextElement());
>                      }
>                    }
> ...
>
> While the child information of the leaves is not used, there is no need
> to query it. Please correct me if I am wrong.
> In my case the number of queries to be executed on the database reduces
> dramatically.

Yes you're right, since getChildren will actually retrieve all child objects
(even if it's useless), which will would be roughly equivalent to increasing
the propfind depth by one (very bad). That should dramatically improve
performance in a lot of situations.

Remy