Project

General

Profile

« Previous | Next » 

Revision 6965

use File.deleteOnExit() not a half hour timer thread to do it.

View differences:

src/edu/ucsb/nceas/metacat/MetacatHandler.java
56 56
import java.util.Iterator;
57 57
import java.util.Map;
58 58
import java.util.Timer;
59
import java.util.TimerTask;
60 59
import java.util.Vector;
61 60
import java.util.zip.ZipEntry;
62 61
import java.util.zip.ZipOutputStream;
......
1082 1081
          
1083 1082
          // set the input stream
1084 1083
          fileInputStream = new FileInputStream(outputFile);
1084
          outputFile.deleteOnExit();
1085 1085
          
1086
          //set a timer to clean up the temp files
1087
          Timer t = new Timer();
1088
          TimerTask tt = new TimerTask() {
1089
              @Override
1090
              public void run()
1091
              {
1092
                  outputFile.delete();
1093
              }
1094
          };
1095
          // destroy the file after 30 minutes (possibly large files)
1096
          t.schedule(tt, 18000000);
1097

  
1098 1086
        }
1099 1087
                
1100 1088
        return fileInputStream;

Also available in: Unified diff