public static void setCacheDir ( File tmpdir ) { String rando = Long . toHexString ( ( long ) ( Math . random ( ) * Long . MAX_VALUE ) ) ; _tmpdir = new File ( tmpdir , "narcache_" + rando ) ; if ( ! _tmpdir . exists ( ) ) { if ( _tmpdir . mkdirs ( ) ) { log . debug ( "Created narya temp cache directory '" + _tmpdir + "'." ) ; } else { log . warning ( "Failed to create temp cache directory '" + _tmpdir + "'." ) ; } } // add a hook to blow away the temp directory when we exit Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { log . info ( "Clearing narya temp cache '" + _tmpdir + "'." ) ; FileUtil . recursiveDelete ( _tmpdir ) ; } } ) ; }
Specifies the directory in which our temporary resource files should be stored .