private static <T> T openDBWithWarning(final DBOperation<T> dbOperation) throws RocksDBException {
    AtomicBoolean operationCompleted = new AtomicBoolean(false);
    ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
    scheduler.schedule(
        () -> {
          if (!operationCompleted.get()) {
            LOG.warn(WARN_MESSAGE);
          }
        },
        DEFAULT_DELAY,
        TimeUnit.SECONDS);

    try {
      T db = dbOperation.open();
      operationCompleted.set(true);
      return db;
    } finally {
      scheduler.shutdown();
    }
  }
A generic method to open a RocksDB database with a warning mechanism.

<p>If the operation takes longer than {@link #DEFAULT_DELAY} seconds, a warning message is
logged.

@param dbOperation a lambda or method reference representing the database opening logic.
@param <T> the type of the database being opened (e.g., {@link OptimisticTransactionDB} or
    {@link TransactionDB}).
@return an instance of the database being opened.
@throws RocksDBException if the database cannot be opened.
plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBOpener.java