Class CacheStartupManager

java.lang.Object
org.infinispan.manager.CacheStartupManager

public class CacheStartupManager extends Object
Orchestrates cache startup during container initialization.

Internal caches are started serially and must all succeed before the cache manager becomes RUNNING. User caches are submitted concurrently to the blocking executor and start in the background. The cache manager does not wait for user caches to initialize.

Since:
16.2
Author:
José Bolina
  • Field Details

  • Constructor Details

    • CacheStartupManager

      public CacheStartupManager()
  • Method Details

    • initialize

      protected void initialize()
    • startInternalCaches

      public void startInternalCaches(Set<String> names)
      Starts internal caches serially. Blocks until all caches are running.

      Failure is fatal. The exception propagates and the cache manager shuts down.

      Parameters:
      names - the names of the internal caches to start. Must not be null.
      Throws:
      RuntimeException - if any internal cache fails to start
      NullPointerException - if the provided names are null
    • startUserCaches

      public CompletionStage<Void> startUserCaches(Set<String> names)
      Submits user caches for concurrent startup via the blocking executor.

      Can be called multiple times and accumulate the tasks across calls. The ProgressTracker tracks the total count and progress.

      If the blocking executor thread pool is too small for concurrent startup, caches are started serially to avoid potential deadlock. Cache components submit nested blocking work during cache.start(), so the pool must have enough threads for both the cache start tasks and the nested work.

      Parameters:
      names - the names of the user caches to start. Must not be null.
      Throws:
      NullPointerException - In case the provided names are null.
    • getState

      public CacheStartupState getState(String name)
      Returns the startup state of a specific cache.
      Parameters:
      name - the cache name to query. Must not be null.
      Returns:
      the current CacheStartupState, or null if the cache is not tracked by this manager
    • getAllStates

      public Map<String, CacheStartupState> getAllStates()
      Returns an unmodifiable snapshot of all tracked caches and their states.
      Returns:
      a map from cache name to CacheStartupState. Never null.
    • stop

      public void stop()
      Signals shutdown.

      Prevents new cache submissions and causes pending tasks to complete with CacheStartupState.FAILED.