@LoadLevel(name="atomic-long", order=999) public class AtomicLongSequenceServiceImpl extends Object implements ISequenceService
AtomicLong 实现的内存序列服务
主要用途: 1)单机单应用运行时才能使用此序列服务。 2)运行单元测试时,用于模拟Mock序列服务。
特点:性能高。
使用说明:应用启动时,需要指定其初始值。
| Constructor and Description |
|---|
AtomicLongSequenceServiceImpl() |
AtomicLongSequenceServiceImpl(long initialValue) |
| Modifier and Type | Method and Description |
|---|---|
long |
currVal(String seqName)
获取当前序列值
|
AtomicLong |
getAtomicLong(String seqName) |
long |
nextVal(String seqName)
获取下一序列值
|
long |
setVal(String seqName,
long newVal)
设置序列值
|
public AtomicLongSequenceServiceImpl(long initialValue)
public AtomicLongSequenceServiceImpl()
public long currVal(@NonNull
String seqName)
ISequenceServicecurrVal in interface ISequenceServiceseqName - 序列名public long nextVal(@NonNull
String seqName)
ISequenceService注意:实现类中不允许抛出 NotSupportedException,该方法是序列服务必须要支持的功能。
nextVal in interface ISequenceServiceseqName - 序列名public long setVal(@NonNull
String seqName,
long newVal)
ISequenceServicesetVal in interface ISequenceServiceseqName - 序列名newVal - 新的序列值public AtomicLong getAtomicLong(String seqName)
Copyright © 2021–2022 EasyJ????. All rights reserved.