### Question:
ChunkUtils { @VisibleForTesting static <T> T processFileExclusively(Path path, Supplier<T> op) { for (;;) { if (LOCKS.add(path)) { break; } } try { return op.get(); } finally { LOCKS.remove(path); } } private  ChunkUtils(); static void writeData(File file, ChunkBuffer data,
      long offset, long len, VolumeIOStats volumeIOStats, boolean sync); static void writeData(FileChannel file, String filename,
      ChunkBuffer data, long offset, long len, VolumeIOStats volumeIOStats
  ); static void readData(File file, ByteBuffer buf,
      long offset, long len, VolumeIOStats volumeIOStats); static boolean validateChunkForOverwrite(File chunkFile,
      ChunkInfo info); static boolean isOverWriteRequested(File chunkFile, ChunkInfo
      chunkInfo); static boolean isOverWritePermitted(ChunkInfo chunkInfo); static void verifyChunkFileExists(File file); static void validateBufferSize(long expected, long actual); static final Set<? extends OpenOption> READ_OPTIONS; static final FileAttribute<?>[] NO_ATTRIBUTES; }### Answer:
@Test public void concurrentProcessing() throws Exception { final int perThreadWait = 1000; final int maxTotalWait = 5000; int threads = 20; List<Path> paths = new LinkedList<>(); try { ExecutorService executor = new ThreadPoolExecutor(threads, threads, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); AtomicInteger processed = new AtomicInteger(); for (int i = 0; i < threads; i++) { Path path = Files.createTempFile(PREFIX, String.valueOf(i)); paths.add(path); executor.execute(() -> { ChunkUtils.processFileExclusively(path, () -> { try { Thread.sleep(perThreadWait); } catch (InterruptedException e) { e.printStackTrace(); } processed.incrementAndGet(); return null; }); }); } try { GenericTestUtils.waitFor(() -> processed.get() == threads, 100, maxTotalWait); } finally { executor.shutdownNow(); } } finally { for (Path path : paths) { FileUtils.deleteQuietly(path.toFile()); } } }