提交 5e243405 编写于 作者: yitter's avatar yitter

auto commit

上级 0e6fbe73
......@@ -11,7 +11,7 @@ namespace Yitter.OrgSystem.TestA
class Program
{
// 测试参数(默认配置下,最佳性能是10W/s)
static int genIdCount = 2;//50000; // 计算ID数量(如果要验证50W效率,请将TopOverCostCount设置为20000或适当增加SeqBitLength)
static int genIdCount = 2;//5000; // 计算ID数量(如果要验证50W效率,请将TopOverCostCount设置为20000或适当增加SeqBitLength)
static short method = 1; // 1-漂移算法,2-传统算法
......
......@@ -38,6 +38,10 @@ namespace Yitter.IdGenerator
/// </summary>
/// <returns></returns>
public static long NextId()
{
if (_IdGenInstance == null)
{
lock (_IdGenInstance)
{
if (_IdGenInstance == null)
{
......@@ -45,6 +49,8 @@ namespace Yitter.IdGenerator
new IdGeneratorOptions() { WorkerId = 0 }
);
}
}
}
return _IdGenInstance.NewLong();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册