Commit a7bd2987 authored by 刘林's avatar 刘林

fix(JG):一码通添加锁

parent a19fb881
...@@ -165,7 +165,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService { ...@@ -165,7 +165,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
* @param batchSize 批量生成个数 * @param batchSize 批量生成个数
* @return List * @return List
*/ */
public List<String> generateBatchSequence(String sequenceKey, int batchSize) { public synchronized List<String> generateBatchSequence(String sequenceKey, int batchSize) {
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码 // 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean lockAcquired = obtainLock(LOCK_KEY_AF); Boolean lockAcquired = obtainLock(LOCK_KEY_AF);
if (Boolean.TRUE.equals(lockAcquired)) { if (Boolean.TRUE.equals(lockAcquired)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment