You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by mb...@apache.org on 2023/01/13 19:57:09 UTC

[netbeans] branch master updated: allow concurrent local indexing while downloading remote indexes.

This is an automated email from the ASF dual-hosted git repository.

mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new a15b78179a allow concurrent local indexing while downloading remote indexes.
     new 5f1a4ed9c5 Merge pull request #5290 from mbien/maven-concurrent-indexing
a15b78179a is described below

commit a15b78179ac7ab52f1fc15971f9bd14e8ca2bed4
Author: Michael Bien <mb...@gmail.com>
AuthorDate: Tue Nov 22 08:59:20 2022 +0100

    allow concurrent local indexing while downloading remote indexes.
---
 .../maven/indexer/NexusRepositoryIndexerImpl.java  | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
index 428a5528c2..ec029d90d1 100644
--- a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
+++ b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
@@ -22,7 +22,6 @@
 
 package org.netbeans.modules.maven.indexer;
 
-import org.netbeans.modules.maven.indexer.api.RepositoryQueries;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -92,6 +91,7 @@ import org.netbeans.modules.maven.indexer.api.NBVersionInfo;
 import org.netbeans.modules.maven.indexer.api.QueryField;
 import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
 import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
+import org.netbeans.modules.maven.indexer.api.RepositoryQueries;
 import org.netbeans.modules.maven.indexer.spi.ArchetypeQueries;
 import org.netbeans.modules.maven.indexer.spi.BaseQueries;
 import org.netbeans.modules.maven.indexer.spi.ChecksumQueries;
@@ -152,7 +152,16 @@ 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);
+
+    /**
+     * For local IO heavy repo indexing tasks and everything what does not involve downloads.
+     */
+    private static final RequestProcessor RP_LOCAL = new RequestProcessor("maven-local-indexing");
+
+    /**
+     * For remote repo download and indexing tasks.
+     */
+    private static final RequestProcessor RP_REMOTE = new RequestProcessor("maven-remote-indexing");
 
     @Override
     public boolean handlesRepository(RepositoryInfo repo) {
@@ -294,7 +303,7 @@ public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementati
         }
         // At least one of the group caches could not be loaded, so rebuild it
         if(needGroupCacheRebuild) {
-            RP.submit(() -> {
+            RP_LOCAL.submit(() -> {
                 try {
                     context.rebuildGroups();
                     storeGroupCache(repo, context);
@@ -637,7 +646,12 @@ public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementati
 
     //spawn the indexing into a separate thread..
     private void spawnIndexLoadedRepo(final RepositoryInfo repo) {
-        RP.post(() -> {
+
+        // 2 RPs allow concurrent local repo indexing during remote index downloads
+        // while also largely avoiding to run two disk-IO heavy tasks at once.
+        RequestProcessor rp = repo.isLocal() ? RP_LOCAL : RP_REMOTE;
+
+        rp.post(() -> {
             getRepoMutex(repo).writeAccess((Mutex.Action<Void>) () -> {
                 try {
                     indexLoadedRepo(repo, true);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists