Commit 862f0283 authored by yanzg's avatar yanzg

修改实例化关系

parent f92e96f4
...@@ -127,7 +127,7 @@ public class CacheLock implements Runnable { ...@@ -127,7 +127,7 @@ public class CacheLock implements Runnable {
}; };
do { do {
// 开启唯一性锁,防止多人运行同一关键字的函数 // 开启唯一性锁,防止多人运行同一关键字的函数
cache.tryLockAndRun(key, lockTime, TimeUnit.SECONDS, runnable); cache.tryLockAndRun(key, lockTime, TimeUnit.MILLISECONDS, runnable);
// 假如没有运行,则等待50毫秒后继续运行 // 假如没有运行,则等待50毫秒后继续运行
if (!runFlag) { if (!runFlag) {
this.waitCount++; this.waitCount++;
...@@ -137,13 +137,18 @@ public class CacheLock implements Runnable { ...@@ -137,13 +137,18 @@ public class CacheLock implements Runnable {
} }
private void funcRun() { private void funcRun() {
if (this.waitCount > 0 && this.funcWait != null) { try {
funcWait.run(); if (this.waitCount > 0 && this.funcWait != null) {
} funcWait.run();
if (this.func != null) { }
func.run(); if (this.func != null) {
func.run();
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
runFlag = true;
} }
runFlag = true;
} }
/** /**
......
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