|
@@ -83,6 +83,13 @@ public class ObjectRedisCacheProcessor {
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
count++;
|
|
count++;
|
|
|
|
+
|
|
|
|
+ t = getRedisClient().get(key, c);
|
|
|
|
+
|
|
|
|
+ if (null != t) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
Boolean locked = getRedisClient().setIfAbsent(cacheLock,
|
|
Boolean locked = getRedisClient().setIfAbsent(cacheLock,
|
|
ThreadLocalUtil.getTraceId(), 30);
|
|
ThreadLocalUtil.getTraceId(), 30);
|
|
|
|
|
|
@@ -90,6 +97,7 @@ public class ObjectRedisCacheProcessor {
|
|
try {
|
|
try {
|
|
getObjectRedisCacheTrigger().fire(appName, className, propKeys);
|
|
getObjectRedisCacheTrigger().fire(appName, className, propKeys);
|
|
getRedisClient().delete(cacheException);
|
|
getRedisClient().delete(cacheException);
|
|
|
|
+ t = getRedisClient().get(key, c);
|
|
break;
|
|
break;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
getRedisClient().set(cacheException, true, 60);
|
|
getRedisClient().set(cacheException, true, 60);
|
|
@@ -97,25 +105,22 @@ public class ObjectRedisCacheProcessor {
|
|
} finally {
|
|
} finally {
|
|
getRedisClient().delete(cacheLock);
|
|
getRedisClient().delete(cacheLock);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- t = getRedisClient().get(key, c);
|
|
|
|
|
|
+ if (null != getRedisClient().get(cacheException, Boolean.class)) {
|
|
|
|
+ throw new ExamCloudRuntimeException(
|
|
|
|
+ "exception happened when loading cache. key=" + key);
|
|
|
|
+ }
|
|
|
|
|
|
- if (null != t) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ // 10秒内未加载完缓存,抛出异常
|
|
|
|
+ if (200 < count) {
|
|
|
|
+ throw new ExamCloudRuntimeException(
|
|
|
|
+ "fail to load cache in 10 seconds. key=" + key);
|
|
|
|
+ }
|
|
|
|
|
|
- if (null != getRedisClient().get(cacheException, Boolean.class)) {
|
|
|
|
- throw new ExamCloudRuntimeException(
|
|
|
|
- "exception happened when loading cache. key=" + key);
|
|
|
|
- }
|
|
|
|
|
|
+ Util.sleep(TimeUnit.MILLISECONDS, 30);
|
|
|
|
|
|
- // 10秒内未加载完缓存,抛出异常
|
|
|
|
- if (200 < count) {
|
|
|
|
- throw new ExamCloudRuntimeException(
|
|
|
|
- "fail to load cache in 10 seconds. key=" + key);
|
|
|
|
}
|
|
}
|
|
- Util.sleep(TimeUnit.MILLISECONDS, 50);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|