Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java (date 1438601743000) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java (date 1438672868000) @@ -316,13 +316,13 @@ if (ids.size() > getBatchCount()) { count += ids.size(); - executor.execute(new Sweeper(ids, exceptionQueue, earliestRefAvailTime)); + sweepInternal(ids, exceptionQueue, earliestRefAvailTime); ids = Lists.newArrayList(); } } if (!ids.isEmpty()) { count += ids.size(); - executor.execute(new Sweeper(ids, exceptionQueue, earliestRefAvailTime)); + sweepInternal(ids, exceptionQueue, earliestRefAvailTime); } count -= exceptionQueue.size(); @@ -367,41 +367,26 @@ ids.clear(); writer.flush(); } - + /** - * Sweeper thread. + * Deletes a batch of blobs from blob store. + * + * @param ids + * @param exceptionQueue + * @param maxModified */ - class Sweeper implements Runnable { - - /** The exception queue. */ - private final ConcurrentLinkedQueue exceptionQueue; - - /** The ids to sweep. */ - private final List ids; - - private final long maxModified; - - public Sweeper(List ids, ConcurrentLinkedQueue exceptionQueue, - long maxModified) { - this.exceptionQueue = exceptionQueue; - this.ids = ids; - this.maxModified = maxModified; - } - - @Override - public void run() { + private void sweepInternal(List ids, ConcurrentLinkedQueue exceptionQueue, long maxModified) { - try { - LOG.debug("Blob ids to be deleted {}", ids); - boolean deleted = blobStore.deleteChunks(ids, getLastMaxModifiedTime(maxModified)); - if (!deleted) { - // Only log and do not add to exception queue since some blobs may not match the - // lastMaxModifiedTime criteria. - LOG.debug("Some blobs were not deleted from the batch : [{}]", ids); - } - } catch (Exception e) { - LOG.warn("Error occurred while deleting blob with ids [{}]", ids, e); - exceptionQueue.addAll(ids); + try { + LOG.debug("Blob ids to be deleted {}", ids); + boolean deleted = blobStore.deleteChunks(ids, getLastMaxModifiedTime(maxModified)); + if (!deleted) { + // Only log and do not add to exception queue since some blobs may not match the + // lastMaxModifiedTime criteria. + LOG.debug("Some blobs were not deleted from the batch : [{}]", ids); + } + } catch (Exception e) { + LOG.warn("Error occurred while deleting blob with ids [{}]", ids, e); + exceptionQueue.addAll(ids); - } } }