code: private void purgeUploadedFiles() {
          long currentTimeMillis = System.currentTimeMillis();
  
          // Do purge if purge delay is past before last purge
          // -------------------------------------------------
          long nextPurgeInMillis =
                  this.m_lastPurgeInMillis + this.m_purgeDelayInMillis;
          if (nextPurgeInMillis < currentTimeMillis) {
              this.m_lastPurgeInMillis = currentTimeMillis;
  
              // Compute limit file time to purged
              // ---------------------------------
              long minStartTime =
                      currentTimeMillis - (this.m_uploadStorageMinutes * 60000);
  
              // List files to purge and remove filename to map
              // This operation is synchronized to be thread-safe
              // ------------------------------------------------
              final List<String> removeList = new ArrayList<String>();
              synchronized (this.m_uploadStartTime) {
                  for (Entry<String, Long> entry :
                          m_uploadStartTime.entrySet()) {
                      String filename = entry.getKey();
                      long startTime = entry.getValue().longValue();
                      if (startTime < minStartTime) {
                          removeList.add(filename);
                      }
                  }
                  for (String filename : removeList) {
                      this.m_uploadStartTime.remove(filename);
                  }
              }
  
              // Delete file to purged
              // This operation is out of synchronised block for performances
              // ------------------------------------------------------------
              for (int i = 0; i < removeList.size(); i++) {
                  String id = removeList.get(i);
  
                  File file = new File(this.m_tempDir, id);
                  if (file.exists()) {
                      if (file.delete()) {
                          logger.info("Removed uploaded file '{}' because it expired.", id);
                      } else {
                          logger.warn("Could not remove expired uploaded file '"
                                      + id + "'. Check permissions in " + m_tempDir.getPath() + " directory.");
                      }
                  }
              }
          }
      }
docs: Deletes expired uploaded files.
  <p/>
  This method is called for each upload. But we respect a minimim delay
  between two purges. This delay is given by m_purgeDelayInMillis.