matthiasblaesing commented on code in PR #5290:
URL: https://github.com/apache/netbeans/pull/5290#discussion_r1069720946
##########
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 think I see a problem here when two local repostories are being indexed
and a new remote repository is requested. This will be stalled until the first
local repository is done indexing. Basicly like this:
- Local Repository R1 is submitted into `RP` to be indexed and locks
`localIndexingPermit`
- Local Repository R2 is submitted into `RP` to be indexed and tries to lock
`localIndexingPermit` (this thread will block at Line 658)
- Remote Repository R3 is submitted into `RP` to be indexed - it does not
execute, as R1 and R2 are "running" in the processor and R3 is queued.
Alternative idea: use two requestprocessors with a through put of 1. One for
remote repos, one for local repos. If I understand your intention correctly,
this should accomplish the same.
--
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