Class AbstractJanitor

java.lang.Object
dev.tachyonmcp.core.server.internal.AbstractJanitor
All Implemented Interfaces:
AutoCloseable

@InternalApi public abstract class AbstractJanitor extends Object implements AutoCloseable
Shared periodic-sweep scheduling for background cleanup tasks (session eviction, task expiry/retention). A single daemon thread runs sweep() at a fixed delay; exceptions from a sweep are caught and logged so one failed pass doesn't cancel future runs.
  • Constructor Details

    • AbstractJanitor

      protected AbstractJanitor(String threadName)
      Creates a janitor with the given thread name.
      Parameters:
      threadName - the daemon thread name
  • Method Details

    • start

      public final void start(Duration interval)
      Starts the periodic sweep at the given interval. Idempotent — later calls no-op.
      Parameters:
      interval - the sweep interval
    • sweep

      protected abstract void sweep()
      One janitor pass.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable