public static final class ClockSeqFunction.ClockSeqPool extends Object
The pool is implemented as an array of 2048 bytes (16384 bits). Each bit of the array corresponds to a clock sequence value.
It is used to avoid that two time-based factories use the same clock sequence at same time in a class loader.
| 构造器和说明 |
|---|
ClockSeqPool() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearPool()
Clear all bits of the byte array that represents the pool.
|
int |
countFree()
Count the free values in the pool.
|
int |
countUsed()
Count the used values out of the pool
|
boolean |
isFree(int value)
Check if a value is free in the pool.
|
boolean |
isUsed(int value)
Check if a value is used out of the pool.
|
int |
random()
Take a random value from the pool.
|
int |
take(int take)
Take a value from the pool.
|
public static final int POOL_MIN
public static final int POOL_MAX
public int take(int take)
If the value to be taken is already in use, it is incremented until a free value is found and returned.
In the case that all pool values are in use, the pool is cleared and the last incremented value is returned.
It does nothing to negative arguments.
take - value to be taken from the poolpublic int random()
public boolean isUsed(int value)
value - a value to be checked in the poolpublic boolean isFree(int value)
value - a value to be checked in the poolpublic int countUsed()
public int countFree()
public void clearPool()
This corresponds to marking all pool values as free
Copyright © 2024. All rights reserved.