public static class UnfairExecutor.TaskHashXorTimeStripeGenerator extends java.lang.Object implements UnfairExecutor.TaskStripeGenerator
Clock.lastKnownTimeNanos()
. This is the fastest built in option, however submissions
of the same task many times without the clock being updated can result in a single thread
being unfairly burdened. Because of that it is highly recommended to over-size your pool if
you are using this distributor.
A possibly more fair, but slower stripe generator would be UnfairExecutor.AtomicStripeGenerator
.
This class should not be constructed, instead it should be provided via the static function
instance()
.
Modifier and Type | Method and Description |
---|---|
long |
getStripe(java.lang.Runnable task)
Generate an identifier for the stripe to distribute the task on to.
|
static UnfairExecutor.TaskHashXorTimeStripeGenerator |
instance()
Provides an instance which can be provided into the constructor of
UnfairExecutor . |
public static UnfairExecutor.TaskHashXorTimeStripeGenerator instance()
UnfairExecutor
.public long getStripe(java.lang.Runnable task)
UnfairExecutor.TaskStripeGenerator
getStripe
in interface UnfairExecutor.TaskStripeGenerator
task
- Task which can be used for referencing in determining the stripe