private void onError() throws StoreException {
    int count = errorCount.incrementAndGet();
    if (count == config.storeIoErrorCountToTriggerShutdown) {
      logger.error("Shutting down BlobStore {} because IO error count exceeds threshold", storeId);
      shutdown(true);
      // Explicitly disable replica to trigger Helix state transition: LEADER -> STANDBY -> INACTIVE -> OFFLINE
      if (config.storeSetLocalPartitionStateEnabled && !isDisabled.getAndSet(true) && replicaStatusDelegates != null) {
        try {
          replicaStatusDelegates.forEach(delegate -> delegate.disableReplica(replicaId));
        } catch (Exception e) {
          logger.error("Failed to disable replica {} due to exception ", replicaId, e);
        }
      }
      metrics.storeIoErrorTriggeredShutdownCount.inc();
      if (diskManager != null) {
        diskManager.onBlobStoreIOError();
      }
    }
  }
On an exception/error, if error count exceeds threshold, properly shutdown store.
ambry-store/src/main/java/com/github/ambry/store/BlobStore.java