anonymous wrote : so there is a magic flag, after all?
There is a flag, but it's not magic :)
I've spent a lot of time on this lately.
A general rule that works for file: urls (but not for jar:file: urls) is the following:
| URLConnection conn = fileUrl.openConnection();
| InputStream in = conn.getInputStream();
| long lastModified;
| try
| {
| lastModified = conn.getLastModified();
| System.out.println("lastModified, "+lastModified);
| }
| finally
| {
| in.close();
| }
|
It's getting and closing the InputStream that does the trick.
For jar:file: urls I could only achieve file lock release by triggering finalizers - which
means it's pretty useless for anything but tests maybe:
| URLConnection conn = jarFileUrl.openConnection();
| conn.setUseCaches(false);
|
| long lastModified = conn.getLastModified();
|
| conn = null;
| jarFileUrl = null;
| System.gc();
| Thread.sleep(500);
| System.gc();
|
In this case I'd say the problem is more with JDK implementation than Windows :)
- marko
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161584#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...