Skip to content

Commit

Permalink
Trying to fixe a performance issue related to resource copying
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Dec 25, 2015
1 parent 0061513 commit 7e41d67
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class HtmlResourceCopier {

private String resourceDirectory;

private static final Object htmlReportResources = new Object();
// private static final Object htmlReportResources = new Object();

public HtmlResourceCopier(final String resourceDirectory) {
super();
Expand All @@ -35,19 +35,17 @@ public void to(final File targetDirectory) throws IOException {
return;
}

synchronized (htmlReportResources) {
recordResourceMarkerIn(targetDirectory);
Pattern resourcePattern = allFilesInDirectory(resourceDirectory);
FileResources fileResource = FileResources.from(resourceDirectory);
recordResourceMarkerIn(targetDirectory);
Pattern resourcePattern = allFilesInDirectory(resourceDirectory);
FileResources fileResource = FileResources.from(resourceDirectory);

Collection<String> reportResources = ResourceList.forResources(resourcePattern).list();
Collection<String> reportResources = ResourceList.forResources(resourcePattern).list();

for (String resourcePath : reportResources) {
if (fileResourceFromAJar(resourcePath)) {
fileResource.copyResourceTo(resourcePath, targetDirectory);
} else if (fileResourceFromPath(resourcePath)) {
fileResource.copyResourceTo(resourcePath, targetDirectory);
}
for (String resourcePath : reportResources) {
if (fileResourceFromAJar(resourcePath)) {
fileResource.copyResourceTo(resourcePath, targetDirectory);
} else if (fileResourceFromPath(resourcePath)) {
fileResource.copyResourceTo(resourcePath, targetDirectory);
}
}
}
Expand Down

0 comments on commit 7e41d67

Please sign in to comment.