mirror of
https://gitee.com/dcren/initializr.git
synced 2026-09-27 14:57:39 +08:00
Polish "Fix thread-safety access in ProjectGenerationInvoker"
See gh-1125
This commit is contained in:
+3
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -56,7 +56,7 @@ public class ProjectGenerationInvoker<R extends ProjectRequest> {
|
|||||||
|
|
||||||
private final ProjectRequestToDescriptionConverter<R> requestConverter;
|
private final ProjectRequestToDescriptionConverter<R> requestConverter;
|
||||||
|
|
||||||
private transient Map<Path, List<Path>> temporaryFiles = new ConcurrentHashMap<>();
|
private final transient Map<Path, List<Path>> temporaryFiles = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public ProjectGenerationInvoker(ApplicationContext parentApplicationContext,
|
public ProjectGenerationInvoker(ApplicationContext parentApplicationContext,
|
||||||
ProjectRequestToDescriptionConverter<R> requestConverter) {
|
ProjectRequestToDescriptionConverter<R> requestConverter) {
|
||||||
@@ -144,10 +144,7 @@ public class ProjectGenerationInvoker<R extends ProjectRequest> {
|
|||||||
|
|
||||||
private void addTempFile(Path group, Path file) {
|
private void addTempFile(Path group, Path file) {
|
||||||
this.temporaryFiles.compute(group, (path, paths) -> {
|
this.temporaryFiles.compute(group, (path, paths) -> {
|
||||||
List<Path> newPaths = paths;
|
List<Path> newPaths = (paths != null) ? paths : new ArrayList<>();
|
||||||
if (newPaths == null) {
|
|
||||||
newPaths = new ArrayList<>();
|
|
||||||
}
|
|
||||||
newPaths.add(file);
|
newPaths.add(file);
|
||||||
return newPaths;
|
return newPaths;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user