autocommit
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user