Package me.ahoo.cosid.segment.concurrent
Interface AffinityJob
- All Superinterfaces:
Runnable
- All Known Implementing Classes:
SegmentChainId.PrefetchJob
Job with affinity for prefetch worker assignment.
Represents a segment prefetch task that has affinity to a specific worker instance for consistent segment allocation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Stringaffinity()Gets the affinity key for worker assignment.getJobId()Gets the unique job identifier.Gets the prefetch worker for this job.default voidhungry()Signals this job is hungry and needs prefetch.voidsetHungerTime(long hungerTime) Sets the hunger time for this job.voidsetPrefetchWorker(PrefetchWorker prefetchWorker) Sets the prefetch worker for this job.
-
Method Details
-
getJobId
String getJobId()Gets the unique job identifier.- Returns:
- the job ID
-
affinity
Gets the affinity key for worker assignment.- Returns:
- the affinity key (defaults to job ID)
-
hungry
default void hungry()Signals this job is hungry and needs prefetch. -
setHungerTime
void setHungerTime(long hungerTime) Sets the hunger time for this job.- Parameters:
hungerTime- time in seconds since epoch
-
getPrefetchWorker
PrefetchWorker getPrefetchWorker()Gets the prefetch worker for this job.- Returns:
- the prefetch worker
-
setPrefetchWorker
Sets the prefetch worker for this job.- Parameters:
prefetchWorker- the worker to set
-