Review request for 6829503
David Holmes - Sun Microsystems
David.Holmes at Sun.COM
Sun Apr 19 12:01:51 UTC 2009
Alan,
> 2. File#deleteOnExit doesn't allow IllegalStateException to be thrown so
> maybe we should change DeleteOnExit#add to be a no-op if its shutdown
> hook is running. If an application is attempting to register files to be
> deleted during shutdown it will always be a timing issue if the file is
> deleted or not.
But a runtime exception is better than silent failure when the file will
not be deleted. And the exception here is not new.
Is this a flaw in the File#deleteOnExit API - because it gives the
illusion that it can always succeed when in fact the code requesting
this can be running concurrently with the code responsible for making it
happen? Maybe that is a deficiency of the whole mechanism - really we
should be using a native deletion mechanism that is only done once the
VM arrives at the termination safepoint - as that is the only time we
know for sure that no more Java code can be executed. But that would be
a RFE on the deleteOnExit mechanism.
Cheers,
David
More information about the core-libs-dev
mailing list