Searching order of ResourceLocator

ResourceLocatorTool finds resources by reverse order of ResourceLocator.addResourceLocator()

It is confusing to me. I'm curious about what is generally rational.



And one more,

because we are using static ResourceLocatorTool, multi-threaded resource loading may conflict each other.

Between Static and instancing version of  ResourceLocatorTool, what is better?



    public static URL locateResource(String resourceType, String resourceName) {
        if (resourceName == null) {
            return null;
        }
        synchronized (locatorMap) {
            ArrayList<ResourceLocator> bases = locatorMap.get(resourceType);
            if (bases != null) {
[b]                for (int i = bases.size(); --i >= 0; ) {[/b]
                    ResourceLocator loc = bases.get(i);
                    URL rVal = loc.locateResource(resourceName);
                    if (rVal != null) {
                        return rVal;
                    }
                }
            }

because we are using static ResourceLocatorTool, multi-threaded resource loading may conflict each other.
Between Static and instancing version of  ResourceLocatorTool, what is better?

Same goes for TextureManager- can't use it from multiple threads.
ResourceLocatorTool finds resources by reverse order of ResourceLocator.addResourceLocator()
It is confusing to me. I'm curious about what is generally rational.

Probably no rational, it is just using recursion and is just taking the last 'thing' off the list.  So it's working like a stack, to work like a queue one would simple pull from the starting index rather than the last...

If everyone has the same opinion, I'll suggest a patch when I have some time.

To fix the locator tool?  Its not broken and unless there is a good reason for changing the order, I see no reason to rock the boat (but that's just me…).  Perhaps others have a differing opinion.

I see. Actually I mean not just for ordering, but static/instance matter.

If I wanna release part of textures, I have to add textures to list and manually release it.

If TextureManager is not static, it would be easy.



Have a nice weekend~

The TextureManager is slated for some work after the 2.0 stable is released; this is probably something that should be addressed then…

Good to hear that.

I'm looking forard to the jme 2.0 stable

Always thanks for the reply  XD

Regarding order, I'd say I prefer it the way it is.



My use case: you have several directories with application data, then you add some other directories for user mods. You would wish the latter to override the former.

Then it would be good to have a way to choose the order.