Beispiel #1
0
 public void run() {
   try {
     if (isStopping()) {
       return;
     }
     final int lastJournalFileId = journal.getLastAppendLocation().getDataFileId();
     final Set<Integer> candidates = journal.getFileMap().keySet();
     LOG.trace("Full gc candidate set:" + candidates);
     if (candidates.size() > 1) {
       // prune current write
       for (Iterator<Integer> iterator = candidates.iterator(); iterator.hasNext(); ) {
         if (iterator.next() >= lastJournalFileId) {
           iterator.remove();
         }
       }
       List<PListImpl> plists = null;
       synchronized (indexLock) {
         synchronized (this) {
           plists = new ArrayList<PListImpl>(persistentLists.values());
         }
       }
       for (PListImpl list : plists) {
         list.claimFileLocations(candidates);
         if (isStopping()) {
           return;
         }
         LOG.trace(
             "Remaining gc candidate set after refs from: " + list.getName() + ":" + candidates);
       }
       LOG.trace("GC Candidate set:" + candidates);
       this.journal.removeDataFiles(candidates);
     }
   } catch (IOException e) {
     LOG.error("Exception on periodic cleanup: " + e, e);
   }
 }