mbien commented on code in PR #5290:
URL: https://github.com/apache/netbeans/pull/5290#discussion_r1069786787
##########
java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java:
##########
@@ -152,7 +153,19 @@ public class NexusRepositoryIndexerImpl implements
RepositoryIndexerImplementati
private static final HashMap<String,Mutex> repoMutexMap = new HashMap<>(4);
private static final Set<Mutex> indexingMutexes = new HashSet<>();
- private static final RequestProcessor RP = new
RequestProcessor("indexing", 1);
+
+ /**
+ * Fixed to two Threads to allow concurrent remote index downloads during
local indexing
+ */
+ private static final RequestProcessor RP = new
RequestProcessor("maven-indexing", 2);
+
+ /**
+ * Best effort attempt to prevent two _local_ repos to be indexed at the
same time to avoid unnecessary IO contention.
+ * Concurrent local+remote indexing is allowed.
+ * This isn't perfect since a download can finish before local repos
finished indexing, tests showed
+ * performance doesn't degrade significantly on solid state drives.
+ */
+ private static final ReentrantLock localIndexingPermit = new
ReentrantLock();
Review Comment:
I initially wanted to add the lock to the main `indexLoadedRepo` method,
which would be the most correct implementation. However the method is already
large enough and it deals with mutexes already. Probably worth splitting up one
day.
So I opted to keep it as simple as possible - but your suggestion is even
simpler. We can still switch to locks later if this doesn't work well enough.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists