public static class UnfairExecutor.AtomicStripeGenerator extends java.lang.Object implements UnfairExecutor.TaskStripeGenerator
AtomicLong
, which means if lots of tasks are being submitted in parallel there can be
a lot of compare and swap overhead compared to UnfairExecutor.TaskHashXorTimeStripeGenerator
.
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.AtomicStripeGenerator |
instance()
Provides an instance which can be provided into the constructor of
UnfairExecutor . |
public static UnfairExecutor.AtomicStripeGenerator 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