1
0
mirror of synced 2025-12-18 11:08:03 +08:00

autocommit

This commit is contained in:
zhouzj
2021-03-26 00:22:12 +08:00
parent ca025ea7cc
commit 7aa0223c49
2 changed files with 124 additions and 124 deletions

View File

@@ -14,7 +14,7 @@ import com.yitter.core.SnowWorkerM2;
public class DefaultIdGenerator implements IIdGenerator {
private final ISnowWorker _SnowWorker;
private static ISnowWorker _SnowWorker = null;
public DefaultIdGenerator(IdGeneratorOptions options) throws IdGeneratorException {
if (options == null) {

View File

@@ -15,14 +15,14 @@ public class YitIdHelper {
private static IIdGenerator idGenInstance = null;
public static IIdGenerator getIdGenInstance()
{
public static IIdGenerator getIdGenInstance() {
return idGenInstance;
}
/**
* 设置参数,建议程序初始化时执行一次
*
* @param options
*/
public static void setIdGenerator(IdGeneratorOptions options) throws IdGeneratorException {
@@ -32,12 +32,12 @@ public class YitIdHelper {
/**
* 生成新的Id
* 调用本方法前,请确保调用了 SetIdGenerator 方法做初始化。
*
* @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();