The close method deletes any temporary files and directories created
during analysis.

@throws Exception thrown if there is an exception deleting temporary
files
19427
@Override
    public void closeAnalyzer() throws Exception {
        if (tempFileLocation != null && tempFileLocation.exists()) {
            LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString());
            final boolean success = FileUtils.delete(tempFileLocation);
            if (!success && tempFileLocation.exists()) {
                final String[] l = tempFileLocation.list();
                if (l != null && l.length > 0) {
                    LOGGER.warn("Failed to delete the Archive Analyzer's temporary files from `{}`, "
                            + "see the log for more details", tempFileLocation.toString());
                }
            }
        }
    }
492455
@Override
  public void close()
  {
    if (!closed)
    {
      try
      {
        if (Files.isDirectory(bindDir))
        {
          String[] dir = bindDir.toFile().list();
          if (dir != null)
          {
            for (String fileName : dir)
            {
              Files.delete(bindDir.resolve(fileName));
            }
          }
          Files.delete(bindDir);
        }
      }
      catch (IOException ex)
      {
        logger.debug("Exception encountered while trying to clean local directory. ", ex);
      }
      finally
      {
        closed = true;
      }
    }
  }
439496
public final void close() throws Exception {
        if (content != null) {
            content.clear();
            content = null;
        }
        iterator = null;
    }
1245047
@Override
  public void close() throws Exception {
    if (closed.compareAndSet(false, true)) {
      executor.shutdown();
      completionExecutor.shutdown();
      if (!executor.awaitTermination(shutdownTimeout, TimeUnit.MILLISECONDS)) {
        LOG.log(Level.WARNING, "Executor did not terminate in " + shutdownTimeout + "ms.");
        final List<Runnable> droppedRunnables = executor.shutdownNow();
        LOG.log(Level.WARNING, "Executor dropped " + droppedRunnables.size() + " tasks.");
      }
      if (!completionExecutor.awaitTermination(shutdownTimeout, TimeUnit.MILLISECONDS)) {
        LOG.log(Level.WARNING, "Executor did not terminate in " + shutdownTimeout + "ms.");
        final List<Runnable> droppedRunnables = completionExecutor.shutdownNow();
        LOG.log(Level.WARNING, "Completion executor dropped " + droppedRunnables.size() + " tasks.");
      }
    }
  }
445252
public void close() throws IOException {
    LOG.info(getTask()+" done; removing files.");
    getTask().getProgress().setStatus("closed");
    mapOutputFile.removeAll(getTask().getTaskID());
  }
357842
@Override
    public void close() {
        if (!closed.getAndSet(true)) {
            if (fc != null) {
                try {
                    fc.close();
                    fc = null;
                } catch (final IOException e) {
                    // Ignore
                }
            }
            if (raf != null) {
                try {
                    raf.close();
                    raf = null;
                } catch (final IOException e) {
                    // Ignore
                }
            }
            if (chunkIdxToByteBuffer != null) {
                chunkIdxToByteBuffer.clear();
                chunkIdxToByteBuffer = null;
            }
            if (mappedByteBuffersCached != null) {
                for (int i = 0; i < mappedByteBuffersCached.length; i++) {
                    if (mappedByteBuffersCached[i] != null) {
                        FileUtils.closeDirectByteBuffer(mappedByteBuffersCached[i], /* log = */ null);
                        mappedByteBuffersCached[i] = null;
                    }
                }
                mappedByteBuffersCached = null;
            }
            nestedJarHandler = null;
        }
    }
497328
public void delete() throws DocumentStoreNotDeletedException {
        try {
            this.close();
        } catch (Exception e) {
            // caught exception could be something benign like DocumentStore already closed, so just log
            logger.log(Level.WARNING, "Caught exception whilst closing DocumentStore in delete()", e);
        }
        if (!location.exists()) {
            String msg = String.format("DocumentStore %s doesn't exist on disk", location);
            logger.warning(msg);
            throw new DocumentStoreNotDeletedException(msg);
        } else {
            try {
                FileUtils.deleteDirectory(location);
            } catch (IOException ioe) {
                String msg = String.format("DocumentStore %s not deleted", location);
                logger.log(Level.WARNING, msg, ioe);
                throw new DocumentStoreNotDeletedException(msg, ioe);
            }
            eventBus.post(new DocumentStoreDeleted(databaseName));
        }
    }
1138791
public synchronized void close() throws IOException {
        if (logStream != null) {
            logStream.close();
        }
        for (FileOutputStream log : streamsToFlush) {
            log.close();
        }
    }
820697
public static void recursiveRemoveDir(File directory) throws Exception {
		if (!directory.exists())
			throw new IOException(directory.toString() + " do not exist!");

		String[] filelist = directory.list();
		File tmpFile = null;
		for (int i = 0; i < filelist.length; i++) {
			tmpFile = new File(directory.getAbsolutePath(), filelist[i]);
			if (tmpFile.isDirectory()) {
				recursiveRemoveDir(tmpFile);
			} else if (tmpFile.isFile()) {
				try {
					tmpFile.delete();
				} catch (Exception ex) {
					throw new Exception(tmpFile.toString() + " can not be deleted " + ex.getMessage());
				}
			}
		}
		try {
			directory.delete();
		} catch (Exception ex) {
			throw new Exception(directory.toString() + " can not be deleted " + ex.getMessage());
		} finally {
			filelist = null;
		}
	}
1237592
@Override
	public void close() throws Exception {
		if (enterUnlessClosed()) {
			try {
				try {
					// this class' own cleanup logic
					resourceManagerLeaderElectionService.shutdown();
					dispatcher.shutdownNow();
				}
				finally {
					// in any case must we call the parent cleanup logic
					super.close();
				}
			}
			finally {
				exit();
			}
		}
	}
1041292
@Override
  public synchronized void close() throws Exception {
    if (this.fileSystem != null && !this.fsClosed) {
      this.fileSystem.close();
      this.fsClosed = true;
    }
  }
554263
public void close() throws IOException {
        clear();
        if (_tempfile != null) {
            _tempfile.close();
            _tempfile = null;
            _tempfilef.delete();
            _tempfilef = null;
        }
    }
460418
private void cleanup() throws IOException {
        JarFileManager.INSTANCE.close();
        TempFileManager.INSTANCE.close();
        MavenResolvers.close();
    }
957737
public void close() throws IOException {
		
		// we go on closing and deleting files in the presence of failures.
		// we remember the first exception to occur and re-throw it later
		Throwable ex = null;
		
		synchronized (this) {
			
			if (closed) {
				return;
			}
			closed = true;
			
			// close the writers
			if (recordsOutFile != null) {
				try {
					recordsOutFile.close();
					recordsOutFile = null;
				} catch (Throwable t) {
					LOG.error("Cannot close the large records spill file.", t);
					ex = ex == null ? t : ex;
				}
			}
			if (keysOutFile != null) {
				try {
					keysOutFile.close();
					keysOutFile = null;
				} catch (Throwable t) {
					LOG.error("Cannot close the large records key spill file.", t);
					ex = ex == null ? t : ex;
				}
			}
			
			// close the readers
			if (recordsReader != null) {
				try {
					recordsReader.close();
					recordsReader = null;
				} catch (Throwable t) {
					LOG.error("Cannot close the large records reader.", t);
					ex = ex == null ? t : ex;
				}
			}
			if (keysReader != null) {
				try {
					keysReader.close();
					keysReader = null;
				} catch (Throwable t) {
					LOG.error("Cannot close the large records key reader.", t);
					ex = ex == null ? t : ex;
				}
			}
			
			// delete the spill files
			if (recordsChannel != null) {
				try {
					ioManager.deleteChannel(recordsChannel);
					recordsChannel = null;
				} catch (Throwable t) {
					LOG.error("Cannot delete the large records spill file.", t);
					ex = ex == null ? t : ex;
				}
			}
			if (keysChannel != null) {
				try {
					ioManager.deleteChannel(keysChannel);
					keysChannel = null;
				} catch (Throwable t) {
					LOG.error("Cannot delete the large records key spill file.", t);
					ex = ex == null ? t : ex;
				}
			}
			
			// close the key sorter
			if (keySorter != null) {
				try {
					keySorter.close();
					keySorter = null;
				} catch (Throwable t) {
					LOG.error("Cannot properly dispose the key sorter and clean up its temporary files.", t);
					ex = ex == null ? t : ex;
				}
			}
			
			memManager.release(memory);
			
			recordCounter = 0;
		}
		
		// re-throw the exception, if necessary
		if (ex != null) { 
			throw new IOException("An error occurred cleaning up spill files in the large record handler.", ex);
		}
	}
1094811
@Override
  public void close() throws IOException {
    if (!closed) {
      objectOutputStream.close();
      fileOutputStream.close();
      closed = true;
    }
  }
1207450
private void removeTempJavaFolder() throws IOException {
        if (removeJavaDir) {
            FileUtils.forceDelete(new File(rootDirectory + directoryName + this.javaDirPath));
        } else if (removeMainDir) {
            FileUtils.forceDelete(new File(rootDirectory + directoryName + this.mainDirPath));
        } else if (removeSrcDir) {
            FileUtils.forceDelete(new File(rootDirectory + directoryName + this.srcDirPath));
        } else if (removeJavaFile) {
            FileUtils.forceDelete(new File(rootDirectory + directoryName + javaDirPath + fileSeparator + TMP_JAVA_FILE));
        }
    }
193948
public void delete() throws IOException {
		synchronized(tempFiles) {
			for(WeakReference<TempFile> tempFileRef : tempFiles) {
				TempFile tempFile = tempFileRef.get();
				if(tempFile!=null) tempFile.delete();
			}
			tempFiles.clear();
		}
	}