public final class StealPool
extends java.lang.Object
implements java.io.Serializable
StealPool is one of the mechanisms to determine the activities that are to be executed by an Executor.
Each executor has two steal pools associated with it: the one it belongs to and the one it can steal from. In addition, an
executor can only execute activities whose AbstractContext matches with the AbstractContext of this executor.
A StealPool consists of either a set of other steal pools, or a single string identification.| Modifier and Type | Field and Description |
|---|---|
static StealPool |
NONE
An executor that belongs to the
NONE steal pool generates activities that cannot be stolen. |
static StealPool |
WORLD
An executor that belongs to the
WORLD steal pool generates activities that can in principle be stolen by any
other executor. |
| Constructor and Description |
|---|
StealPool(java.lang.String tag)
Constructs a StealPool of the specified tag.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getTag()
Returns the tag of this steal pool.
|
int |
hashCode() |
boolean |
isNone()
Determines if this steal pool is equal to the
NONE steal pool. |
boolean |
isWorld()
Determines if this steal pool is equal to the
WORLD steal pool. |
static StealPool |
merge(StealPool... pools)
Returns a StealPool that is the merge result of the steal pools passed as arguments.
|
boolean |
overlap(StealPool other)
Determines if this steal pool has some member steal pool in common with the specified steal pool.
|
StealPool |
randomlySelectPool(java.util.Random random)
Selects a random member steal pool from the steal pool at hand.
|
StealPool[] |
set()
Returns the list of steal pools of which this steal pool consists.
|
java.lang.String |
toString() |
public static StealPool WORLD
WORLD steal pool generates activities that can in principle be stolen by any
other executor. An executor that can steal from this steal pool can steal from any pool, except NONE.public static StealPool NONE
NONE steal pool generates activities that cannot be stolen. An executor that
can steal from this steal pool can in fact not steal at all. Note that NONE takes preference over
WORLD.public StealPool(java.lang.String tag)
tag - the tagjava.lang.IllegalArgumentException - when a null pointer is provided.public static StealPool merge(StealPool... pools)
NONE is returned. If the argument list contains WORLD, WORLD is returned.pools - the steal pool argumentsjava.lang.IllegalArgumentException - when the argument list contains a null pointer.public boolean overlap(StealPool other)
NONE never
overlaps, not even with NONE. And then WORLD overlaps with any steal pool, except NONE.other - the steal pool to determine overlap with.public java.lang.String getTag()
null is
returned.public boolean isWorld()
WORLD steal pool.WORLD steal pool.public boolean isNone()
NONE steal pool.NONE steal pool.public StealPool[] set()
public StealPool randomlySelectPool(java.util.Random random)
random - the random number generator to usepublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object