refactor(thread): 使用 threadId 替换 getId 方法

- 将 ai-cam-image-processor 线程命名中的 thread.getId() 替换为 thread.threadId()
- 将视频片段获取任务中的 Thread.currentThread().getId() 替换为 Thread.currentThread().threadId()
- 统一使用 threadId 方法提高代码一致性
- 保持线程标识符的唯一性和可读性
This commit is contained in:
2026-02-24 14:30:31 +08:00
parent 7454111615
commit 703a5baf13
2 changed files with 2 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ public class SourceRepository {
Runtime.getRuntime().availableProcessors(),
runnable -> {
Thread thread = new Thread(runnable);
thread.setName("ai-cam-image-processor-" + thread.getId());
thread.setName("ai-cam-image-processor-" + thread.threadId());
thread.setDaemon(true);
return thread;
}

View File

@@ -342,7 +342,7 @@ public class VideoPieceGetter {
ffmpegTask.setDuration(duration);
ffmpegTask.setOffsetStart(BigDecimal.valueOf(offset, 3));
// 使用时间戳和线程ID确保输出文件名唯一性,避免并发冲突
String uniqueSuffix = System.currentTimeMillis() + "_" + Thread.currentThread().getId();
String uniqueSuffix = System.currentTimeMillis() + "_" + Thread.currentThread().threadId();
File outFile = new File(deviceId.toString() + "_" + faceSampleId + "_" + uniqueSuffix + ".mp4");
ffmpegTask.setOutputFile(outFile.getAbsolutePath());
boolean result = startFfmpegTask(ffmpegTask);