Any reason why a call to
File.createTempFile("prefix", ".suffix", new File("C:\\");
might take 40-50 seconds to complete?
Update:
I knocked up a little test harness that benchmarks creating 100 test files on C:\ and the default tmp folder. Specifying “C:\” is consistently ~0.9ms slower than just leaving it on the default, allowing for JVM warmup time, GC pauses etc. (No clue why this should be, but its not a problem.)
Not a single run suffered from anything like that level of delay, which suggests the app is doing something else first which is causing the problem.
Using Suns JVM 1.6.0_12 client.
Time ago when developing a swing based application I came across a bug in the JVM which will cause the file requester open to be really slow if there is a big zip file on your desktop. And there is also another issue related when a big number of files exists in a folder.
Probably there can be a correlation with your issue. Which version of JDK are you usign ?
Please take a look at this thread for some info:
https://bugs.java.com/bugdatabase/view_bug?bug_id=4638397
http://groups.google.com/group/comp.lang.java.help/browse_thread/thread/ec8854f82f381123
Defrag the disk is also a good idea.