Issue Details (XML | Word | Printable)

Key: SPR-1868
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Heiko Erhardt
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Framework

'UseCaches = false' for ClassPathResource

Created: 07/Apr/06 08:43 AM   Updated: 31/May/06 05:36 AM
Component/s: SpringCORE
Affects Version/s: 1.2.6, 1.2.7
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Win XP

Virtual Machine: Sun JVM - 1.4.2


 Description  « Hide
This is related to SPR-1459

1.2.6 release note reads:
UrlResource sets the "UseCaches" flag to "false" for every URLConnection, mainly to avoid jar file locking on Windows

This should be done in ClassPathResource as well, same situation.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Juergen Hoeller added a comment - 08/Apr/06 07:03 PM
Note that ClassPathResource doesn't use any URLConnection at present, hence we can't set the UseCaches flag there.

We would have to open our own URLConnection there based on "ClassLoader.getResource" instead of using "ClassLoader.getResourceAsStream". However, we can't do this in a general fashion, since some ClassLoader implementations override the latter method in a custom fashion. In other words, "getResource().openStream()" is not necessarily equal to "getResourceAsStream".

As a consequence, I'm afraid it is unavoidable that class path resource access will cause file locks. This is not really a Spring-specific problem, though, since the JDK's primary way of accessing the content of a class path resource (ClassLoader.getResourceAsStream) causes the lock here...

Juergen