[hg] main-silver: Added periodic logging of threads and their st...

  • From:
  • To:
  • Subject: [hg] main-silver: Added periodic logging of threads and their st...
  • Date: Thu, 19 Sep 2013 05:30:34 -0700

changeset b0d379d0952b in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/b0d379d0952b
description:
        Added periodic logging of threads and their statii for debugging 
purposes.

diffstat:

 debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java | 
 44 +++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diffs (72 lines):

diff --git 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
--- 
a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
+++ 
b/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java
@@ -210,6 +210,8 @@
     
     private InputOutput                 io;
 
+    private PeriodicThreadsDump         ptd;
+
     // init 
....................................................................
 
     public JPDADebuggerImpl (ContextProvider lookupProvider) {
@@ -1202,6 +1204,9 @@
             virtualMachine = vm;
             operator = o;
         }
+        if (logger.isLoggable(Level.FINEST)) {
+            ptd = new PeriodicThreadsDump(vm);
+        }
         synchronized (canBeModifiedLock) {
             canBeModified = null; // Reset the can be modified flag
         }
@@ -1394,6 +1399,9 @@
                 vm = virtualMachine;
                 virtualMachine = null;
             }
+            if (ptd != null) {
+                ptd.finish();
+            }
             setState (STATE_DISCONNECTED);
             if (jsr45EngineProviders != null) {
                 for (Iterator<JSR45DebuggerEngineProvider> i = 
jsr45EngineProviders.iterator(); i.hasNext();) {
@@ -2485,4 +2493,38 @@
 
     }
 
-}
+    private static class PeriodicThreadsDump implements Runnable {
+        
+        private static final int INTERVAL = 5000;
+        private RequestProcessor rp = new 
RequestProcessor(PeriodicThreadsDump.class.getName());
+        private VirtualMachine vm;
+        private volatile boolean finish = false;
+        
+        public PeriodicThreadsDump(VirtualMachine vm) {
+            this.vm = vm;
+            rp.post(this, INTERVAL);
+        }
+        
+        public void finish() {
+            finish = true;
+        }
+
+        @Override
+        public void run() {
+            List<ThreadReference> allThreads = vm.allThreads();
+            System.err.println("All Threads:");
+            for (ThreadReference tr : allThreads) {
+                String name = tr.name();
+                boolean suspended = tr.isSuspended();
+                int suspendCount = tr.suspendCount();
+                int status = tr.status();
+                System.err.println(name+"\t SUSP = "+suspended+", COUNT = 
"+suspendCount+", STATUS = "+status);
+            }
+            System.err.println("");
+            if (!finish) {
+                rp.post(this, INTERVAL);
+            }
+        }
+    }
+
+}

[hg] main-silver: Added periodic logging of threads and their st...

mentlicher 09/19/2013

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close