private void checkIfStoreIsStale() throws StoreException {
    File lastModifiedFile = getLatestFilefromDir(replicaId.getReplicaPath());

    long lastModifiedTimeInMilliseconds = time.milliseconds();
    if (lastModifiedFile != null) {
      lastModifiedTimeInMilliseconds = lastModifiedFile.lastModified();
    }
    Date date = new Date(lastModifiedTimeInMilliseconds);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    String lastAliveTime = formatter.format(date);
    logger.info(
        "checkIfStoreIsStale " + replicaId.getReplicaPath() + " last modified file " + ((lastModifiedFile != null)
            ? lastModifiedFile.getAbsolutePath() : "") + " last alive time " + lastAliveTime);

    if (config.storeStaleTimeInDays != 0
        && lastModifiedTimeInMilliseconds + TimeUnit.DAYS.toMillis(config.storeStaleTimeInDays) < time.milliseconds()) {
      logger.error("checkIfStoreIsStale " + replicaId.getReplicaPath() + " is stale. ");
      BlobStore.staleBlobCount.getAndIncrement();
      if (config.storeBlockStaleBlobStoreToStart) {
        throw new StoreException("BlobStore " + dataDir + " is stale ", StoreErrorCodes.StoreStaleError);
      }
    }
  }
Check if the store is stale.
If yes, throw exception
ambry-store/src/main/java/com/github/ambry/store/BlobStore.java