Source:
<code>public ImmutableCollection<HStoreFile> close() throws IOException { this.archiveLock.lock(); this.lock.writeLock().lock(); try { ImmutableCollection<HStoreFile> result = storeEngine.getStoreFileManager().clearFiles(); Collection<HStoreFile> compactedfiles = storeEngine.getStoreFileManager().clearCompactedFiles(); if (CollectionUtils.isNotEmpty(compactedfiles)) { removeCompactedfiles(compactedfiles); } if (!result.isEmpty()) { ThreadPoolExecutor storeFileCloserThreadPool = this.region .getStoreFileOpenAndCloseThreadPool(); String executingThreadNamePrefix = "StoreFileCloser-" + this.region.getRegionInfo().getEncodedName() + "-" + this.getColumnFamilyName(); AtomicInteger threadId = new AtomicInteger(0); CompletionService<Void> completionService = new ExecutorCompletionService<>(storeFileCloserThreadPool); for (HStoreFile f : result) { completionService.submit(new Callable<Void>() { @Override public Void call() throws IOException { <START> Thread t = Thread.currentThread(); <END> String threadName = t.getName(); t.setName(executingThreadNamePrefix + "-" + threadId.getAndIncrement()); boolean evictOnClose = cacheConf != null? cacheConf.shouldEvictOnClose(): true; f.closeStoreFile(evictOnClose); t.setName(threadName); return null; } }); } IOException ioe = null; try { for (int i = 0; i < result.size(); i++) { try { Future<Void> future = completionService.take(); future.get(); } catch (InterruptedException e) { if (ioe == null) { ioe = new InterruptedIOException(); ioe.initCause(e); } } catch (ExecutionException e) { if (ioe == null) { ioe = new IOException(e.getCause()); } } } } finally { } if (ioe != null) { throw ioe; } } LOG.trace("Closed {}", this); return result; } finally { this.lock.writeLock().unlock(); this.archiveLock.unlock(); } }</code><technical_language>bit hacky</technical_language>

Target:
public ImmutableCollection<HStoreFile> close() throws IOException { this.archiveLock.lock(); this.lock.writeLock().lock(); try { ImmutableCollection<HStoreFile> result = storeEngine.getStoreFileManager().clearFiles(); Collection<HStoreFile> compactedfiles = storeEngine.getStoreFileManager().clearCompactedFiles(); if (CollectionUtils.isNotEmpty(compactedfiles)) { removeCompactedfiles(compactedfiles, cacheConf != null ? cacheConf.shouldEvictOnClose() : true); } if (!result.isEmpty()) { ThreadPoolExecutor storeFileCloserThreadPool = this.region .getStoreFileOpenAndCloseThreadPool(); CompletionService<Void> completionService = new ExecutorCompletionService<>(storeFileCloserThreadPool); for (HStoreFile f : result) { completionService.submit(new Callable<Void>() { @Override public Void call() throws IOException { boolean evictOnClose = cacheConf != null? cacheConf.shouldEvictOnClose(): true; f.closeStoreFile(evictOnClose); return null; } }); } IOException ioe = null; for (int i = 0; i < result.size(); i++) { try { Future<Void> future = completionService.take(); future.get(); } catch (InterruptedException e) { if (ioe == null) { ioe = new InterruptedIOException(); ioe.initCause(e); } } catch (ExecutionException e) { if (ioe == null) { ioe = new IOException(e.getCause()); } } } if (ioe != null) { throw ioe; } } LOG.trace("Closed {}", this); return result; } finally { this.lock.writeLock().unlock(); this.archiveLock.unlock(); } }