auto commit
This commit is contained in:
@@ -4,23 +4,40 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.yitter</groupId>
|
||||
<artifactId>yitter.idgenerator</artifactId>
|
||||
<groupId>com.github.yitter</groupId>
|
||||
<artifactId>yitter-idgenerator</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
|
||||
<name>yitter.idgenerator</name>
|
||||
<description>Shorter ID and faster generation with a new snowflake drift algorithm. The core is to shorten the ID length, but also can have a very high instantaneous concurrent processing capacity (50W/0.1s), and powerful configuration capacity.</description>
|
||||
<name>yitter-idgenerator</name>
|
||||
<description>Shorter ID and faster generation with a new snowflake drift algorithm. The core is to shorten the ID
|
||||
length, but also can have a very high instantaneous concurrent processing capacity (50W/0.1s), and powerful
|
||||
configuration capacity.
|
||||
</description>
|
||||
<url>https://github.com/yitter/idgenerator</url>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>yitter</id>
|
||||
<name>yitter</name>
|
||||
<email>yitter@126.com</email>
|
||||
<url>https://gitee.com/yitter/idgenerator</url>
|
||||
<url>https://github.com/yitter/idgenerator</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/yitter/idgenerator.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/yitter/idgenerator.git</developerConnection>
|
||||
<url>https://github.com/yitter/idgenerator.git</url>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>MIT</name>
|
||||
<url>https://github.com/yitter/IdGenerator/blob/main/LICENSE</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
@@ -30,64 +47,85 @@
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}</directory>
|
||||
<targetPath>META-INF</targetPath>
|
||||
<includes>
|
||||
<include>LICENSE</include>
|
||||
<include>NOTICE</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>false</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
@@ -2,7 +2,7 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.contract;
|
||||
package com.github.yitter.contract;
|
||||
|
||||
public interface IIdGenerator {
|
||||
long newLong() throws IdGeneratorException;
|
||||
@@ -2,7 +2,7 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.contract;
|
||||
package com.github.yitter.contract;
|
||||
|
||||
public interface ISnowWorker {
|
||||
long nextId() throws IdGeneratorException;
|
||||
@@ -2,7 +2,7 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.contract;
|
||||
package com.github.yitter.contract;
|
||||
|
||||
public class IdGeneratorException extends RuntimeException {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.contract;
|
||||
package com.github.yitter.contract;
|
||||
|
||||
/**
|
||||
* 雪花算法使用的参数
|
||||
@@ -2,7 +2,7 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.contract;
|
||||
package com.github.yitter.contract;
|
||||
|
||||
/**
|
||||
* Id生成时回调参数
|
||||
@@ -2,12 +2,12 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.core;
|
||||
package com.github.yitter.core;
|
||||
|
||||
import com.yitter.contract.ISnowWorker;
|
||||
import com.yitter.contract.IdGeneratorException;
|
||||
import com.yitter.contract.IdGeneratorOptions;
|
||||
import com.yitter.contract.OverCostActionArg;
|
||||
import com.github.yitter.contract.ISnowWorker;
|
||||
import com.github.yitter.contract.IdGeneratorOptions;
|
||||
import com.github.yitter.contract.OverCostActionArg;
|
||||
import com.github.yitter.contract.IdGeneratorException;
|
||||
|
||||
public class SnowWorkerM1 implements ISnowWorker {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.core;
|
||||
package com.github.yitter.core;
|
||||
|
||||
import com.yitter.contract.IdGeneratorException;
|
||||
import com.yitter.contract.IdGeneratorOptions;
|
||||
import com.github.yitter.contract.IdGeneratorOptions;
|
||||
import com.github.yitter.contract.IdGeneratorException;
|
||||
|
||||
public class SnowWorkerM2 extends SnowWorkerM1 {
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.idgen;
|
||||
package com.github.yitter.idgen;
|
||||
|
||||
import com.yitter.contract.ISnowWorker;
|
||||
import com.yitter.contract.IdGeneratorException;
|
||||
import com.yitter.contract.IdGeneratorOptions;
|
||||
import com.yitter.contract.IIdGenerator;
|
||||
import com.yitter.core.SnowWorkerM1;
|
||||
import com.yitter.core.SnowWorkerM2;
|
||||
import com.github.yitter.contract.IIdGenerator;
|
||||
import com.github.yitter.contract.ISnowWorker;
|
||||
import com.github.yitter.contract.IdGeneratorException;
|
||||
import com.github.yitter.contract.IdGeneratorOptions;
|
||||
import com.github.yitter.core.SnowWorkerM1;
|
||||
import com.github.yitter.core.SnowWorkerM2;
|
||||
|
||||
|
||||
public class DefaultIdGenerator implements IIdGenerator {
|
||||
@@ -1,45 +1,43 @@
|
||||
/*
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.yitter.idgen;
|
||||
|
||||
import com.yitter.contract.IdGeneratorException;
|
||||
import com.yitter.contract.IdGeneratorOptions;
|
||||
import com.yitter.contract.IIdGenerator;
|
||||
|
||||
/**
|
||||
* 这是一个调用的例子,默认情况下,单机集成者可以直接使用 nextId()。
|
||||
*/
|
||||
public class YitIdHelper {
|
||||
|
||||
private static IIdGenerator idGenInstance = null;
|
||||
|
||||
public static IIdGenerator getIdGenInstance() {
|
||||
return idGenInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置参数,建议程序初始化时执行一次
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
public static void setIdGenerator(IdGeneratorOptions options) throws IdGeneratorException {
|
||||
idGenInstance = new DefaultIdGenerator(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成新的Id
|
||||
* 调用本方法前,请确保调用了 SetIdGenerator 方法做初始化。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static long nextId() throws IdGeneratorException {
|
||||
if (idGenInstance == null) {
|
||||
idGenInstance = new DefaultIdGenerator(new IdGeneratorOptions((short) 1));
|
||||
}
|
||||
|
||||
return idGenInstance.newLong();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 版权属于:yitter(yitter@126.com)
|
||||
* 开源地址:https://gitee.com/yitter/idgenerator
|
||||
*/
|
||||
package com.github.yitter.idgen;
|
||||
|
||||
import com.github.yitter.contract.IIdGenerator;
|
||||
import com.github.yitter.contract.IdGeneratorException;
|
||||
import com.github.yitter.contract.IdGeneratorOptions;
|
||||
|
||||
/**
|
||||
* 这是一个调用的例子,默认情况下,单机集成者可以直接使用 nextId()。
|
||||
*/
|
||||
public class YitIdHelper {
|
||||
|
||||
private static IIdGenerator idGenInstance = null;
|
||||
|
||||
public static IIdGenerator getIdGenInstance() {
|
||||
return idGenInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置参数,建议程序初始化时执行一次
|
||||
*/
|
||||
public static void setIdGenerator(IdGeneratorOptions options) throws IdGeneratorException {
|
||||
idGenInstance = new DefaultIdGenerator(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成新的Id
|
||||
* 调用本方法前,请确保调用了 SetIdGenerator 方法做初始化。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static long nextId() throws IdGeneratorException {
|
||||
if (idGenInstance == null) {
|
||||
idGenInstance = new DefaultIdGenerator(new IdGeneratorOptions((short) 1));
|
||||
}
|
||||
|
||||
return idGenInstance.newLong();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.yitter.test;
|
||||
package com.github.yitter.test;
|
||||
|
||||
import com.yitter.contract.IIdGenerator;
|
||||
import com.github.yitter.contract.IIdGenerator;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.yitter.test;
|
||||
package com.github.yitter.test;
|
||||
|
||||
import com.yitter.contract.IdGeneratorOptions;
|
||||
import com.yitter.contract.IIdGenerator;
|
||||
import com.yitter.idgen.DefaultIdGenerator;
|
||||
import com.yitter.idgen.YitIdHelper;
|
||||
import com.github.yitter.contract.IIdGenerator;
|
||||
import com.github.yitter.contract.IdGeneratorOptions;
|
||||
import com.github.yitter.idgen.DefaultIdGenerator;
|
||||
import com.github.yitter.idgen.YitIdHelper;
|
||||
|
||||
public class StartUp {
|
||||
|
||||
Reference in New Issue
Block a user