forked from alibaba/jvm-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
sandbox-core/src/main/java/com/alibaba/jvm/sandbox/core/util/Sequencer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
package com.alibaba.jvm.sandbox.core.util; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
import java.com.alibaba.jvm.sandbox.spy.Spy; | ||
|
||
/** | ||
* 序列发生器 | ||
* 序列发生器用途非常广泛,主要用于圈定全局唯一性标识 | ||
* Created by luanjia@taobao.com on 16/5/20. | ||
* | ||
* @author luanjia@taobao.com | ||
*/ | ||
public class Sequencer { | ||
|
||
// 序列生成器 | ||
private final AtomicInteger generator; | ||
|
||
public Sequencer(int initialValue) { | ||
generator = new AtomicInteger(initialValue); | ||
} | ||
|
||
/** | ||
* 生成下一条序列 | ||
* | ||
* @return 下一条序列 | ||
*/ | ||
public int next() { | ||
return generator.getAndIncrement(); | ||
// 这里直接修改为引用Spy的全局唯一序列,修复 #125 | ||
return Spy.nextSequence(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+61 Bytes
(100%)
sandbox-core/src/test/resources/lib/sandbox-spy-1.2.0-for-qatest.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters