|
@@ -1,8 +1,6 @@
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.util;
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.util;
|
|
|
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.exporttask.ExportTask;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.exporttask.ExportTask;
|
|
-import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
|
@@ -12,24 +10,16 @@ public class AsyncExportConcurrentUtil {
|
|
|
|
|
|
private static ReentrantLock checkTaskThreadInitLock = new ReentrantLock();
|
|
private static ReentrantLock checkTaskThreadInitLock = new ReentrantLock();
|
|
|
|
|
|
- private static Integer taskThreadCount = 1;
|
|
|
|
-
|
|
|
|
public static void checkOrStartJob() {
|
|
public static void checkOrStartJob() {
|
|
if (taskThreadInit) {
|
|
if (taskThreadInit) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
try {
|
|
try {
|
|
checkTaskThreadInitLock.lock();
|
|
checkTaskThreadInitLock.lock();
|
|
if (!taskThreadInit) {
|
|
if (!taskThreadInit) {
|
|
taskThreadInit = true;
|
|
taskThreadInit = true;
|
|
- SysPropertyCacheBean spc = CacheHelper.getSysProperty("oe.export.jobCount");
|
|
|
|
- if (spc != null && spc.getValue() != null) {
|
|
|
|
- taskThreadCount = (Integer) spc.getValue();
|
|
|
|
- }
|
|
|
|
- for (int i = 0; i < taskThreadCount; i++) {
|
|
|
|
- ExportTask thr = new ExportTask();
|
|
|
|
- thr.start();
|
|
|
|
- }
|
|
|
|
|
|
+ new ExportTask().start();
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
if (checkTaskThreadInitLock.isLocked()) {
|
|
if (checkTaskThreadInitLock.isLocked()) {
|