|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.thread.Sequencer
public class Sequencer
It generates sequence of incremental numbers, ranging from 0 to Long.MAX_VALUE,
without repeating or missing of any number.
生成序列数字,保证不重复渐增,范围从0到Long.MAX_VALUE,循环往复。
It is multi-thread safe, and has high performance.
它是线程安全的,而且性能高。
| Field Summary | |
|---|---|
protected AtomicLong |
currentValue
|
| Constructor Summary | |
|---|---|
Sequencer()
Constructs an instance that generates numbers starting from 0. 创建一个实例,且初始值为0。 |
|
Sequencer(long initialValue)
Constructs an instance that generates numbers starting from specified value. 创建一个实例,且初始值为指定的值。 |
|
| Method Summary | |
|---|---|
long |
next()
Gets the next number in sequence. 获得下一个序列值。 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AtomicLong currentValue
| Constructor Detail |
|---|
public Sequencer(long initialValue)
initialValue - the first value that will be returned by next()public Sequencer()
| Method Detail |
|---|
public long next()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||