kriegaex commented on a change in pull request #95:
URL: https://github.com/apache/maven-shade-plugin/pull/95#discussion_r637390118



##########
File path: src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
##########
@@ -694,6 +702,11 @@ private void addResource( Set<String> resources, 
JarOutputStream jos, String nam
 
         List<Relocator> relocators;
 
+        // Use thread-local, just in case 'map*' calls are ever done 
concurrently. Make sure that the using class
+        // initialises this value according to its needs, usually setting the 
value to false per file before starting
+        // relocation.
+        ThreadLocal<Boolean> wasRelocated = new ThreadLocal<>();

Review comment:
       > multithreading is unlikely to be faster to write a zip
   
   Good point, I agree. But reading and processing could be done concurrently, 
then queuing to a single writing thread in the random order of which thread or 
pipeline is done with its transformation first. I do admit it is a theoretical 
situation. If after my PR is merged you want to ditch the thread-local in 
favour of an ordinary boolean (then no longer final in that case, of course) in 
a subsequent refactoring step, I will not object. The thread-local can always 
be re-introduced on demand. But at least we have one commit documenting what an 
(imperfect, but working) solution could look like.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to