增加lock(Sequences sequences, boolean ignoreSeq)、release(Sequences sequences, boolean ignoreSeq)方法

This commit is contained in:
yhl452493373
2022-02-21 16:03:41 +08:00
parent f039ed30c9
commit 4cbf9d72d3
5 changed files with 86 additions and 12 deletions

View File

@@ -8,7 +8,7 @@
使用方法:
+ 在项目中放置jar包的地方把seq-1.6.2.jar、seq-1.6.2-sources.jar、seq-1.6.2-pom.xml复制过去
+ 在项目中放置jar包的地方把seq-1.7.2.jar、seq-1.7.2-sources.jar、seq-1.7.2-pom.xml复制过去
+ 在pom.xml中增加以下内容然后执行maven命令mvn clean
```xml
@@ -18,7 +18,7 @@
<dependency>
<groupId>com.yanghuanglin</groupId>
<artifactId>seq</artifactId>
<version>1.6.2</version>
<version>1.7.2</version>
<exclusions>
<!-- 如若你项目中有引用spring-jdbc则需要排除seq的jdbc依赖 -->
<exclusion>
@@ -50,13 +50,13 @@
</goals>
<configuration>
<!-- ${project.basedir}表示当前项目的根目录 -->
<file>${project.basedir}/lib/seq-1.6.2.jar</file>
<pomFile>${project.basedir}/lib/seq-1.6.2-pom.xml</pomFile>
<sources>${project.basedir}/lib/seq-1.6.2-sources.jar</sources>
<file>${project.basedir}/lib/seq-1.7.2.jar</file>
<pomFile>${project.basedir}/lib/seq-1.7.2-pom.xml</pomFile>
<sources>${project.basedir}/lib/seq-1.7.2-sources.jar</sources>
<repositoryLayout>default</repositoryLayout>
<groupId>com.yanghuanglin</groupId>
<artifactId>seq</artifactId>
<version>1.6.2</version>
<version>1.7.2</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
@@ -461,6 +461,17 @@ public interface Generator {
*/
boolean lock(Sequences sequences);
/**
* 忽略{@link Sequences#getSeq()} ,仅通过{@link Sequences#getKey()}和{@link Sequences#getType()}来锁定序号。
* <p/>
* 如果ignoreSeq为false则等价于{@link #lock(Sequences)}
*
* @param sequences 需要锁定的序号
* @param ignoreSeq 是否忽略序号
* @return 锁定结果
*/
boolean lock(Sequences sequences, boolean ignoreSeq);
/**
* 释放所有未使用的序号
* <p/>
@@ -499,6 +510,16 @@ public interface Generator {
*/
void release(Sequences sequences);
/**
* 忽略{@link Sequences#getSeq()}来释放指定序号。一般用于业务对象删除后,对应序号需要回收使用时。
* <p/>
* 如果ignoreSeq为false则等价于{@link #release(Sequences)}
*
* @param sequences 需要释放的序号。一般是一个通过{@link Sequences#setKey(String)}、{@link Sequences#setType(String)}、{@link Sequences#setSeq(Long)}三方法一起手动构建或通过{@link Sequences#Sequences(String, String, Long)}构造方法构建的实例对象
* @param ignoreSeq 是否忽略序号
*/
void release(Sequences sequences, boolean ignoreSeq);
/**
* 清空所有闲置序号和未锁定序号
*/
@@ -524,4 +545,5 @@ public interface Generator {
void clearBefore(Date end);
}
```