cc 2 semanas atrás
pai
commit
19f75aaf0b

+ 13 - 5
ai-server/src/main/java/com/zsjz/ai/common/utils/LuceneManager.java

@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
  *
  * <p><b>案件上下文从哪来</b>:{@link CaseContextHolder#get()}(只读 ThreadLocal)。
  * 清洗任务跑在虚拟线程 / 线程池上,调用方必须先用
- * {@link CaseContextHolder#runWith(Long, Runnable)} 显式绑定案件 ID;
+ * {@link CaseContextHolder#runWith(Long, Long, Runnable)} 显式绑定案件 ID;
  * 取不到时本类会抛异常明确失败,而不是静默写到错误的索引里。
  */
 public class LuceneManager {
@@ -47,10 +47,14 @@ public class LuceneManager {
 
     private static final int BATCH_SIZE = 1000;
 
-    /** caseId → 索引资源 */
+    /**
+     * caseId → 索引资源
+     */
     private static final Map<Long, Holder> HOLDERS = new ConcurrentHashMap<>();
 
-    /** caseId → 攒批缓冲 */
+    /**
+     * caseId → 攒批缓冲
+     */
     private static final Map<Long, List<SearchDTO>> BUFFERS = new ConcurrentHashMap<>();
 
     private LuceneManager() {
@@ -162,7 +166,9 @@ public class LuceneManager {
         logger.info("段合并完成, caseId={}", caseId);
     }
 
-    /** 关闭指定案件的索引资源(退出案件时调用) */
+    /**
+     * 关闭指定案件的索引资源(退出案件时调用)
+     */
     public static void close(Long caseId) {
         if (caseId == null) {
             return;
@@ -175,7 +181,9 @@ public class LuceneManager {
         closeHolder(holder, caseId);
     }
 
-    /** 关闭全部案件的索引资源(应用停止时调用) */
+    /**
+     * 关闭全部案件的索引资源(应用停止时调用)
+     */
     public static void closeAll() {
         BUFFERS.clear();
         HOLDERS.forEach((caseId, holder) -> closeHolder(holder, caseId));