Class DefaultPrefetchWorker

java.lang.Object
java.lang.Thread
me.ahoo.cosid.segment.concurrent.DefaultPrefetchWorker
All Implemented Interfaces:
Runnable, PrefetchWorker

public class DefaultPrefetchWorker extends Thread implements PrefetchWorker
Default prefetch worker implementation.

Runs a background thread that periodically executes affinity jobs to prefetch ID segments before they are exhausted.

  • Constructor Details

    • DefaultPrefetchWorker

      public DefaultPrefetchWorker(Duration prefetchPeriod)
      Creates a worker with specified prefetch period.
      Parameters:
      prefetchPeriod - the period between prefetch runs
  • Method Details

    • shutdown

      public void shutdown()
      Description copied from interface: PrefetchWorker
      Shuts down the worker.
      Specified by:
      shutdown in interface PrefetchWorker
    • submit

      public void submit(AffinityJob affinityJob)
      Description copied from interface: PrefetchWorker
      Submits a job for prefetching.
      Specified by:
      submit in interface PrefetchWorker
      Parameters:
      affinityJob - the job to submit
    • cancel

      public void cancel(AffinityJob affinityJob)
      Description copied from interface: PrefetchWorker
      Cancels a prefetch job.
      Specified by:
      cancel in interface PrefetchWorker
      Parameters:
      affinityJob - the job to cancel
    • wakeup

      public void wakeup(AffinityJob affinityJob)
      Description copied from interface: PrefetchWorker
      Wakes up a job for immediate processing.
      Specified by:
      wakeup in interface PrefetchWorker
      Parameters:
      affinityJob - the job to wake up
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread