@ -128,6 +128,7 @@ public final class yacy {
* @param startupFree free memory at startup time , to be used later for statistics
* /
private static void startup ( final File dataHome , final File appHome , final long startupMemFree , final long startupMemTotal , final boolean gui ) {
String tmpdir = null ;
try {
// start up
System . out . println ( copyright ) ;
@ -202,6 +203,12 @@ public final class yacy {
lock = channel . tryLock ( ) ; // lock yacy.running
} catch ( final Exception e ) { }
// set jvm tmpdir to a subdir for easy cleanup (as extensive use file.deleteonexit waists memory during long runs, as todelete files names are collected and never cleaned up during runtime)
try {
tmpdir = java . nio . file . Files . createTempDirectory ( "yacy-tmp-" ) . toString ( ) ; // creates sub dir in jvm's temp (see System.property "java.io.tempdir")
System . setProperty ( "java.io.tmpdir" , tmpdir ) ;
} catch ( IOException ex ) { }
try {
sb = new Switchboard ( dataHome , appHome , "defaults/yacy.init" . replace ( "/" , File . separator ) , conf ) ;
} catch ( final RuntimeException e ) {
@ -386,6 +393,8 @@ public final class yacy {
} finally {
}
if ( tmpdir ! = null ) FileUtils . deletedelete ( new File ( tmpdir ) ) ; // clean up temp dir (set at startup as subdir of system.propery "java.io.tmpdir")
ConcurrentLog . config ( "SHUTDOWN" , "goodbye. (this is the last line)" ) ;
ConcurrentLog . shutdown ( ) ;
shutdownSemaphore . release ( 1000 ) ;