Package me.ahoo.cosid.segment.concurrent
Class DefaultPrefetchWorker
java.lang.Object
java.lang.Thread
me.ahoo.cosid.segment.concurrent.DefaultPrefetchWorker
- All Implemented Interfaces:
Runnable,PrefetchWorker
Default prefetch worker implementation.
Runs a background thread that periodically executes affinity jobs to prefetch ID segments before they are exhausted.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPrefetchWorker(Duration prefetchPeriod) Creates a worker with specified prefetch period. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(AffinityJob affinityJob) Cancels a prefetch job.voidrun()voidshutdown()Shuts down the worker.voidsubmit(AffinityJob affinityJob) Submits a job for prefetching.voidwakeup(AffinityJob affinityJob) Wakes up a job for immediate processing.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yieldMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface me.ahoo.cosid.segment.concurrent.PrefetchWorker
getName
-
Constructor Details
-
DefaultPrefetchWorker
Creates a worker with specified prefetch period.- Parameters:
prefetchPeriod- the period between prefetch runs
-
-
Method Details
-
shutdown
public void shutdown()Description copied from interface:PrefetchWorkerShuts down the worker.- Specified by:
shutdownin interfacePrefetchWorker
-
submit
Description copied from interface:PrefetchWorkerSubmits a job for prefetching.- Specified by:
submitin interfacePrefetchWorker- Parameters:
affinityJob- the job to submit
-
cancel
Description copied from interface:PrefetchWorkerCancels a prefetch job.- Specified by:
cancelin interfacePrefetchWorker- Parameters:
affinityJob- the job to cancel
-
wakeup
Description copied from interface:PrefetchWorkerWakes up a job for immediate processing.- Specified by:
wakeupin interfacePrefetchWorker- Parameters:
affinityJob- the job to wake up
-
run
public void run()
-