Hi,

Ian Boston schrieb:
> Hi,
> While looking at making it possible to bind more than one
> ResourceProvider to a URL  see [1], I noticed that the
> ResourceProviderEntry appeared to be a very active area of code with a
> lot of recursion, especially when you actually start to deploy a
> reasonable number of servlets. This lead me to think that it should be
> possible to convert the loops into lookups and speed it up. I thought it
> was simple, a week later I now know its not so simple.

Yes, because the providers are organized in a tree of
ResourceProviderEntry instances where each entry acts as a node and has
a list of child entries.

Each Entry has a prefix, which is a partial path.

To find a matching child entry, the list has to be scanned for an entry
whose prefix matches.

If the prefix would be just names (or labels) instead of partial paths,
we could build a map of child entries indexed by name and then just walk
down the tree by indexing into the map.

To do this we would have to create a lot of intermediate entries  ....

Now, you can say that the price to pay is the memory consumption of the
"empty" entries and splitting the path to walk down the tree. But you
gain faster access (may well be true) and have simpler access -- in fact
it would probably also simplify the synthetic resource case in the
getResource(ResourceResolver, String, String) method.

> 
> Since the whole concept of binding ResourceProviders is probably going
> to be highly contentious [2] since its intended to allow virtualization
> of the mapping between URLs and jcr URI's I haven't committed anything.
> I have put the patch set (which is not completely working ) up [3] at
> codereview.
> 
> I have a question before I spend more time.
> 
> Am I wasting my time ?

The question is, where are you heading ?

At the moment looking at your patch I cannot understand what the
ResourceProviderEntry2 is all about ....

Are you just adding support to add more than one ResourceProvider to a
ResourceProviderEntry -- which would kind of solve the issue of
registration collision.

Or do you want to refactor the ResourceProviderEntry tree ?

Both are ok for me...

> 
> (Obviously if I am not, I will clean the patch set up and make it work,
> I believe it may also fix some issues with Servlet Registration)

which ? the ones with servlet path collisions ?

Regards
Felix

> Ian
> 
> 1 http://markmail.org/thread/jeh4a7z4i6skkfci
> 2 http://markmail.org/thread/roumyelolpciboci
> 3 http://codereview.appspot.com/124094
> 

Reply via email to