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.
Description
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.
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 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
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