From 33e6b0a90d1f30b63527e9e01dfa1a650c548404 Mon Sep 17 00:00:00 2001 From: yitter Date: Thu, 7 Jul 2022 22:43:32 +0800 Subject: [PATCH] =?UTF-8?q?NextId=E4=B8=AD=E4=B8=8D=E5=86=8D=E5=88=9B?= =?UTF-8?q?=E5=BB=BAGenerator=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/Yitter.IdGenerator/YitIdHelper.cs | 24 +++++++++---------- .../com/github/yitter/idgen/YitIdHelper.java | 6 ++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/C#.NET/source/Yitter.IdGenerator/YitIdHelper.cs b/C#.NET/source/Yitter.IdGenerator/YitIdHelper.cs index f53f6c7..5633df3 100644 --- a/C#.NET/source/Yitter.IdGenerator/YitIdHelper.cs +++ b/C#.NET/source/Yitter.IdGenerator/YitIdHelper.cs @@ -39,18 +39,18 @@ namespace Yitter.IdGenerator /// public static long NextId() { - if (_IdGenInstance == null) - { - lock (_IdGenInstance) - { - if (_IdGenInstance == null) - { - _IdGenInstance = new DefaultIdGenerator( - new IdGeneratorOptions() { WorkerId = 0 } - ); - } - } - } + //if (_IdGenInstance == null) + //{ + // lock (_IdGenInstance) + // { + // if (_IdGenInstance == null) + // { + // _IdGenInstance = new DefaultIdGenerator( + // new IdGeneratorOptions() { WorkerId = 0 } + // ); + // } + // } + //} return _IdGenInstance.NewLong(); } diff --git a/Java/source/src/main/java/com/github/yitter/idgen/YitIdHelper.java b/Java/source/src/main/java/com/github/yitter/idgen/YitIdHelper.java index 31b6005..868ce02 100644 --- a/Java/source/src/main/java/com/github/yitter/idgen/YitIdHelper.java +++ b/Java/source/src/main/java/com/github/yitter/idgen/YitIdHelper.java @@ -34,9 +34,9 @@ public class YitIdHelper { * @return */ public static long nextId() throws IdGeneratorException { - if (idGenInstance == null) { - idGenInstance = new DefaultIdGenerator(new IdGeneratorOptions((short) 1)); - } + //if (idGenInstance == null) { + // idGenInstance = new DefaultIdGenerator(new IdGeneratorOptions((short) 1)); + //} return idGenInstance.newLong(); }