refactor(接口测试): 按照线程组隔离文件读取逻辑

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-08-07 15:38:12 +08:00 committed by fit2-zhao
parent f96c359571
commit 4f9f9ee2d1
1 changed files with 10 additions and 3 deletions

View File

@ -575,8 +575,15 @@ public class FileServer {
* @return {@link File} instance
*/
public File getResolvedFile(String path) {
log.info("getResolvedFile: {}", path);
String threadName = JMeterContextService.getContext().getThread().getThreadName();
if (!StringUtils.contains(path, threadName)) {
path = StringUtils.join(threadName, path);
}
reserveFile(path);
return files.get(path).file;
FileEntry fileEntry = files.get(path);
return fileEntry != null ? fileEntry.file : null;
}
private static class FileEntry {