fix #1754 replace with commonPool
This commit is contained in:
parent
115bda20d2
commit
0bc4c6f306
6 changed files with 16 additions and 10 deletions
|
@ -24,6 +24,7 @@ import java.io.Reader;
|
|||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
@ -285,14 +286,14 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asUploadHtml());
|
||||
verifyToken(() -> asUploadHtml());
|
||||
new Thread(() -> {
|
||||
ForkJoinPool.commonPool().execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(form.badWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
badWordService.importCsv(reader);
|
||||
suggestHelper.storeAllBadWords(false);
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
saveInfo(messages -> messages.addSuccessUploadBadWord(GLOBAL));
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.Reader;
|
|||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -319,7 +320,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asUploadHtml());
|
||||
verifyToken(() -> asUploadHtml());
|
||||
new Thread(() -> {
|
||||
ForkJoinPool.commonPool().execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(form.elevateWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
elevateWordService.importCsv(reader);
|
||||
suggestHelper.deleteAllElevateWord(false);
|
||||
|
@ -327,7 +328,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
saveInfo(messages -> messages.addSuccessUploadElevateWord(GLOBAL));
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.Writer;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -145,14 +146,14 @@ public class ApiAdminBadwordAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> post$upload(final UploadForm body) {
|
||||
validateApi(body, messages -> {});
|
||||
new Thread(() -> {
|
||||
ForkJoinPool.commonPool().execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(body.badWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
badWordService.importCsv(reader);
|
||||
suggestHelper.storeAllBadWords(false);
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
return asJson(new ApiResult.ApiResponse().status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.Writer;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -157,14 +158,14 @@ public class ApiAdminElevatewordAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> post$upload(final UploadForm body) {
|
||||
validateApi(body, messages -> {});
|
||||
new Thread(() -> {
|
||||
ForkJoinPool.commonPool().execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(body.elevateWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
elevateWordService.importCsv(reader);
|
||||
suggestHelper.storeAllElevateWords(false);
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
return asJson(new ApiResult.ApiResponse().status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
|
@ -56,7 +57,7 @@ public class KeyMatchHelper {
|
|||
}
|
||||
|
||||
public void update() {
|
||||
new Thread(() -> reload(reloadInterval)).start();
|
||||
ForkJoinPool.commonPool().execute(() -> reload(reloadInterval));
|
||||
}
|
||||
|
||||
public List<KeyMatch> getAvailableKeyMatchList() {
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -215,7 +216,7 @@ public class SearchLogHelper {
|
|||
e.setUpdatedAt(now);
|
||||
return e;
|
||||
});
|
||||
new Thread(() -> userInfoBhv.insertOrUpdate(userInfo)).start();
|
||||
ForkJoinPool.commonPool().execute(() -> userInfoBhv.insertOrUpdate(userInfo));
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue