- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
/tmp/bug6503430*.tmp
Tue, 2010-06-08, 09:28
Hi,
Since the changeset #21323[1], garbage files named as bug60503430*.tmp
will be generated in the tmp directory, whenever running scala programs.
It is not so nice, IMHO.
File.scala has the following code[2],
// this is a workaround for
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6503430
// we are using a static initializer to statically initialize a java
class so we don't
// trigger java.lang.InternalErrors later when using it concurrently.
{
val tmp = JFile.createTempFile("bug6503430", null, null)
val in = new FileInputStream(tmp).getChannel()
val out = new FileOutputStream(tmp, true).getChannel()
out.transferFrom(in, 0, 0)
()
}
I'm not familiar with JDK bug #6503430[3], but is it impossible to
delete that tmp file after calling tranferFrom method?
That bug entry has the following comment,
CUSTOMER SUBMITTED WORKAROUND :
Before starting your application, add a single-threaded piece of code that
calls FileChannel.transferFrom() from another FileChannel to ensure that
the initialization is done correctly. After that, all subsequent
invocations will work fine.
It seems to me that there is no problem to delete tmp file after the
initialization
by FileChannel.tranferFrom(), according to that comment.
[1] https://lampsvn.epfl.ch/trac/scala/changeset/21323
[2] https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/compiler/scal...
[3] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6503430
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Skype callto://jcraft/
Twitter: @ymnk
On Tue, Jun 08, 2010 at 05:28:26PM +0900, Atsuhiko Yamanaka wrote:
> Since the changeset #21323[1], garbage files named as bug60503430*.tmp
> will be generated in the tmp directory, whenever running scala
> programs. It is not so nice, IMHO.
That is really uncool, sorry about that. When I wrote that code I
believe I was under the impression that files created via createTempFile
were automatically deleted on JVM exit, but now I see you have to
request that, and it isn't guaranteed anyway. I fixed it.