You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by en...@apache.org on 2021/10/06 20:09:19 UTC

[netbeans] 02/02: Correction of layer location and thread filtering.

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

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

commit 3584df036d33007053bdc409c7eada0d89ac26f4
Author: Martin Entlicher <ma...@oracle.com>
AuthorDate: Fri Oct 1 09:53:50 2021 +0200

    Correction of layer location and thread filtering.
---
 .../modules/debugger/jpda/JPDADebuggerImpl.java    | 22 ++++++++--------
 java/java.lsp.server/manifest.mf                   |  1 -
 .../netbeans/modules/nbcode/integration/layer.xml  |  3 +++
 .../org/netbeans/modules/java/lsp/server/layer.xml | 30 ----------------------
 4 files changed, 13 insertions(+), 43 deletions(-)

diff --git a/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java b/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
index 1085334..3c4921a 100644
--- a/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
+++ b/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
@@ -1989,28 +1989,26 @@ public class JPDADebuggerImpl extends JPDADebugger {
 
         // Create threads in parallel.
         // Constructor of JPDAThreadImpl calls getName() and getStatus(), which take time on slow connection during remote debugging.
-        List<JPDAThread> threads = new ArrayList<>(n);
+        JPDAThread[] threads = new JPDAThread[n];
         if (n > 0) {
-            AtomicBoolean filteredThreads = new AtomicBoolean(false);
             processInParallel(n, (i) -> {
                 JPDAThreadImpl thread = getThread(tl.get(i));
                 if (!thread.getName().contains(ThreadsCache.THREAD_NAME_FILTER_PATTERN)) {
-                    threads.set(i, thread);
+                    threads[i] = thread;
                 } else {
-                    threads.set(i, null);
-                    filteredThreads.set(true);
+                    threads[i] = null;
                 }
             });
-            if (filteredThreads.get()) {
-                Iterator<JPDAThread> it = threads.iterator();
-                while (it.hasNext()) {
-                    if (it.next() == null) {
-                        it.remove();
-                    }
+            List<JPDAThread> threadsFiltered = new ArrayList<>(n);
+            for (JPDAThread t : threads) {
+                if (t != null) {
+                    threadsFiltered.add(t);
                 }
             }
+            return Collections.unmodifiableList(threadsFiltered);
+        } else {
+            return Collections.emptyList();
         }
-        return Collections.unmodifiableList(threads);
     }
 
     private void processInParallel(int n, Consumer<Integer> task) {
diff --git a/java/java.lsp.server/manifest.mf b/java/java.lsp.server/manifest.mf
index 78c39b3..32384b0 100644
--- a/java/java.lsp.server/manifest.mf
+++ b/java/java.lsp.server/manifest.mf
@@ -3,5 +3,4 @@ AutoUpdate-Show-In-Client: true
 OpenIDE-Module: org.netbeans.modules.java.lsp.server
 OpenIDE-Module-Implementation-Version: 1
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/lsp/server/Bundle.properties
-OpenIDE-Module-Layer: org/netbeans/modules/java/lsp/server/layer.xml
 
diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/layer.xml b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/layer.xml
index 8820b7f..794101d 100644
--- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/layer.xml
+++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/layer.xml
@@ -21,6 +21,9 @@
 -->
 <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
 <filesystem>
+    <folder name="Debugger">
+        <file name="org-netbeans-modules-debugger-jpda-ui-CurrentThreadAnnotationListener.instance_hidden"/>
+    </folder>
     <folder name="Services">
         <folder name="AutoupdateType">
             <file name="82pluginportal-update-provider.instance_hidden"/>
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/layer.xml b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/layer.xml
deleted file mode 100644
index 311b57a..0000000
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/layer.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
--->
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
-<filesystem>
-    <folder name="Debugger">
-        <file name="org-netbeans-modules-debugger-jpda-ui-CurrentThreadAnnotationListener.instance_hidden"/>
-        <folder name="netbeans-JPDASession">
-            <!--file name="org-netbeans-modules-debugger-jpda-ui-focus-FocusSuspendController.instance_hidden"/-->
-        </folder>
-    </folder>
-</filesystem>
\ No newline at end of file

---------------------------------------------------------------------
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