@Test
  public void concurrentForceDeleteTest() throws Exception {
    // concurrent force delete with different IDs.
    int blobCount = 2000 / PUT_RECORD_SIZE + 1;
    assertTrue(blobCount >= 2);
    List<Deleter> deleters = new ArrayList<>(blobCount);
    for (int i = 0; i < blobCount; i++) {
      MockId id = getUniqueId();
      deleters.add(new Deleter(id, true));
    }

    ExecutorService executorService = Executors.newFixedThreadPool(deleters.size());
    try {
      List<Future<CallableResult>> futures = executorService.invokeAll(deleters);
      verifyDeleteFutures(deleters, futures);
    } finally {
      executorService.shutdownNow();
    }

    // concurrent force delete with the same ID.
    deleters.clear();
    deleters = new ArrayList<>(blobCount);
    MockId id = getUniqueId();
    for (int i = 0; i < blobCount; i++) {
      deleters.add(new Deleter(id, true));
    }

    executorService = Executors.newFixedThreadPool(deleters.size());
    int failedCount = 0;
    int successCount = 0;
    try {
      List<Future<CallableResult>> futures = executorService.invokeAll(deleters);
      for (int i = 0; i < deleters.size(); i++) {
        Future<CallableResult> future = futures.get(i);
        try {
          future.get(1, TimeUnit.SECONDS);
          // one future is successful.
          verifyGetFailure(id, StoreErrorCodes.IDDeleted);
          successCount++;
        } catch (ExecutionException e) {
          // all the others fail.
          failedCount++;
          assertTrue(e.getCause() instanceof StoreException);
          assertEquals(StoreErrorCodes.AlreadyExist, ((StoreException) e.getCause()).getErrorCode());
        }
      }
      // one is successful, all the others fails.
      assertEquals(successCount, 1);
      assertTrue(failedCount > 0);
      assertEquals(failedCount + successCount, futures.size());
    } finally {
      executorService.shutdownNow();
    }
  }
Tests the case where there are many concurrent FORCE DELETEs on different Blob IDs or on same BLob ID.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java