Java has finalizer methods. These are blocks of code that run on certain times, but you usually don’t know when. When the planets are aligned you can do some finalization. You usually avoid these or should try to avoid them.
Luckily Java will sometimes use finalizers without telling. An innocent piece of code that opens a connection to an URL and checks for the last modification date (getLastModified()) will open a java.io.FileInputStream and close it only in the finalizer, i.e. exactly when the planets are aligned.
I stumbled upon this while debugging JavaRebel and trying to figure out why JBoss needed couple of thousand filehandles when no applications were deployed. A deployment scanner checking all of the files every few seconds will do the trick:)