Example #1
0
 @Override
 public void close() {
   if (fileName != null) {
     if (tempFile != null) {
       tempFile.stopAutoDelete();
       tempFile = null;
     }
     deleteFile(handler, fileName);
   }
 }
Example #2
0
 @Override
 public void unlink(DataHandler handler) {
   if (linked && fileName != null) {
     String temp;
     // synchronize on the database, to avoid concurrent temp file
     // creation / deletion / backup
     synchronized (handler) {
       temp = getFileName(handler, -1, objectId);
       deleteFile(handler, temp);
       renameFile(handler, fileName, temp);
       tempFile = FileStore.open(handler, temp, "rw");
       tempFile.autoDelete();
       tempFile.closeSilently();
       fileName = temp;
       linked = false;
     }
   }
 }