You've already forked FrameTour-BE
refactor(thread): 使用 threadId 替换 getId 方法
- 将 ai-cam-image-processor 线程命名中的 thread.getId() 替换为 thread.threadId() - 将视频片段获取任务中的 Thread.currentThread().getId() 替换为 Thread.currentThread().threadId() - 统一使用 threadId 方法提高代码一致性 - 保持线程标识符的唯一性和可读性
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user