Thread dump: any way to do it programmaticly?

Sun introduced a new deadlock detection utility with 1.4.1: if you type invoke with Ctrl Break (windoze) / Ctrl + (unix) on the shell command line which launched your jvm, you will get a thread dump to std out
     http://java.sun.com/j2se/1.4.2/docs/guide/vm/
But I am faced with a situation where I would like to programmaticly dump the thread state, that is, from my java code itself I would like to issue a command to thread dump to some OutputStream. (In my case, I would like to do this if my program detected some problem that will cause it to abort, and I would like to do the thread dump first so that I can inspect it afterwards and see what the thread state was at the time.)
Does anyone know how to do this?
Is there a way of overriding System.in, say, so that you can send the chars equivalent to Ctrl Break to the jvm?

You can look at the new APIs in JDK 5.0: getStackTrace
and Thread.getAllStackTraces.
-Alexis

Similar Messages

  • WL 7.0 thread dump question

    Hi,
    I am using weblogic 7.0 windows 2000. I have seen unique behaviour with this,
    if the server is not accessed for prolonged time, say overnight and in the morning
    if I want to take thread dump(by hitting Ctrl+break) it will not work. I need
    to restart server to get thread dump, any idea about this?
    Yogesh

    Ctrl+break is a JVM interrupt command, not WLS.
    Is the server accessible? I mean does it respond for PING
    BTW, what JDk you are using?
    Kumar
    Yogesh wrote:
    Hi,
    I am using weblogic 7.0 windows 2000. I have seen unique behaviour with this,
    if the server is not accessed for prolonged time, say overnight and in the morning
    if I want to take thread dump(by hitting Ctrl+break) it will not work. I need
    to restart server to get thread dump, any idea about this?
    Yogesh

  • Output of the thread dump taken in unix for weblogic using kill -3 oprion

    Hi
    I am executing the kill -3 <PID> command in the unix box for weblogic server to get the thread dump.
    I am not able to find where the output of the thread dump is getting saved.Please advice.
    Regards
    Abhishek

    Hi,
    You can following the below link which shows you how to take thread dumps in *9 different ways* and where they get written also
    Topic: Taking Thread Dumps - 9 Ways
    http://middlewaremagic.com/weblogic/?p=823
    Regards,
    Ravish Mody
    http://middlewaremagic.com/weblogic/?page_id=1749
    Come, Join Us and Experience The Magic…

  • What's a good way to do a thread dump into a separate file

    What is a good way to do a thread dump automatically into a separate file.
    Example. I run a script to do the thread dump, but unfortunetly, it goes into my stdout log file with the rest of my weblogic errors.
    Any ideas? I want it in a separate file when I run my script?

    Do a Google search on "Drobo S" "benchmark."  I don't have a Drobo S, only the regular Drobo.  But here's a guy who tested one on Windows:
    http://mansurovs.com/drobo-s-review-usb-3-0-2nd-generation
    This one has it a bit faster:
    http://the-gadgeteer.com/2011/12/31/drobo-s-storage-array-review/
    Do read up on a few reviews of it, and be absolutely clear that interface speed (i.e. eSATA versus Firewire versus Thunderbolt) is NOT the same as the performance of the system.  The Drobo cannot keep up with any interfaces... at least the Drobo and the Drobo S cannot.
    I am not using the FS model which is a NAS.  I am using the plain old "Drobo" which is slower than the Drobo S, but that's not to say that the Drobo S is fast, because it is not.
    The Drobo in theory is really attractive: Dead simple to manage, can mix and match drive sizes, offers you some data protection, etc.  However do note that protected storage is not, in and of itself, a backup.  You need other backups besides just the data on the Drobo.  And, because it's so slow, it's really not a great fit for photo storage.  See this review from a guy who used to think the Drobo was great for that and then appended his review:
    http://www.stuckincustoms.com/drobo-review/
    To be as clear as possible, IMO the BEST backup strategy with something like Aperture (so long as your managed Aperture library is of a manageable size, like < 800 GB), is to get a few small portable Firewire 800 drives and keep vaults on each one.  They are great because they are easy to use, to have with you, are bus powered, and you WILL offsite them.

  • Thunderbird puts a new message at the end of the thread. Is there any way of changing this preference to listing new message at top of the thread?

    Thunderbird puts a new message at the end of the thread.
    Is there any way of changing this preference so that new messages are displayed at the top of the thread.
    This is is more logical. You need to see new message in thread directly, rather than scanning to end of thread to see what is there.

    No it is not possible. The newest message is attached to the message it is in reply to.
    The conversations add-on might better suit your needs. see https://addons.mozilla.org/thunderbird/addon/gmail-conversation-view/?src=ss

  • Is there any Way to find Which case is Executing in LabVIEW VI programmat​ically and Display it..

    Is there any Way to find Which case is Executing in LabVIEW VI programmatically and Display it..
    Solved!
    Go to Solution.

    I wrote this a few years ago: http://lavag.org/files/file/199-state-machine-foll​ower/
    This JKI RCF Plugin sets the Visible Frame property of a Case Structure while the owning VI is running. Use it to follow the execution through the cases in your string-based State Machine/Sequencer when Execution Highlighting isn't fast enough (and, it's never fast enough).
    The use-case I wrote this to improve is setting a Breakpoint on the Error wire coming out of the main Case Structure and probing the Case Selector terminal so I can float-probe wires during execution. The problem with this is that I had to manually select the current frame every time. This is boring, so I developed this plugin to automatically set the Visible Frame to the case most recently executed.
    You might be able to adapt it to your needs.  The basic idea is that a custom probe on the wire to the Case structure's selection terminal sends a notification to a VI that displays the appropriate case.
    We might be able to help you develop something easier if you'll give us more information.  Is it OK if the code to display the case is in the same VI?
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Is there any way I can request admin to delete my own thread?

    Hi,
    Is there any way I can request admin to delete my own thread?

    I think this is not possible.
    But why you want to delete an own thread?

  • Any way to get additional dump information?

    Occasionally java crashes when running our java application on Red Hat Linux 7.1. The crashes occur about 2-3 times a month with the application running on about a dozen different machines. When java crashes it writes out a dump similar to this one:
    Unexpected Signal : 11 occurred at PC=0x4053BD7D
    Function=follow_roots_or_mark_for_unloading__7nmethodiRi+0x3C9
    Library=/usr/java/j2re1.4.1_01/lib/i386/server/libjvm.so
    Dynamic libraries:
    08048000-0804e000 r-xp 00000000 03:05 125152 /usr/java/j2re1.4.1_01/bin/java
    0804e000-0804f000 rw-p 00005000 03:05 125152 /usr/java/j2re1.4.1_01/bin/java
    40000000-40016000 r-xp 00000000 03:05 170561 /lib/ld-2.2.2.so
    40016000-40017000 rw-p 00015000 03:05 170561 /lib/ld-2.2.2.so
    40018000-4001b000 r--s 00000000 03:05 78466 /usr/java/j2re1.4.1_01/lib/ext/dnsns.jar
    4001b000-40028000 r-xp 00000000 03:05 108530 /lib/i686/libpthread-0.9.so
    40028000-40030000 rw-p 0000c000 03:05 108530 /lib/i686/libpthread-0.9.so
    40030000-40033000 r-xp 00000000 03:05 170574 /lib/libdl-2.2.2.so
    40033000-40034000 rw-p 00002000 03:05 170574 /lib/libdl-2.2.2.so
    40034000-4015a000 r-xp 00000000 03:05 108526 /lib/i686/libc-2.2.2.so
    4015a000-40160000 rw-p 00125000 03:05 108526 /lib/i686/libc-2.2.2.so
    40164000-405fc000 r-xp 00000000 03:05 78475 /usr/java/j2re1.4.1_01/lib/i386/server/libjvm.so
    405fc000-40806000 rw-p 00497000 03:05 78475 /usr/java/j2re1.4.1_01/lib/i386/server/libjvm.so
    40818000-4082b000 r-xp 00000000 03:05 170579 /lib/libnsl-2.2.2.so
    4082b000-4082d000 rw-p 00012000 03:05 170579 /lib/libnsl-2.2.2.so
    4082f000-40852000 r-xp 00000000 03:05 108528 /lib/i686/libm-2.2.2.so
    40852000-40853000 rw-p 00022000 03:05 108528 /lib/i686/libm-2.2.2.so
    40853000-4085c000 r-xp 00000000 03:05 78471 /usr/java/j2re1.4.1_01/lib/i386/native_threads/libhpi.so
    4085c000-4085d000 rw-p 00008000 03:05 78471 /usr/java/j2re1.4.1_01/lib/i386/native_threads/libhpi.so
    4085e000-4086e000 r-xp 00000000 03:05 125198 /usr/java/j2re1.4.1_01/lib/i386/libverify.so
    4086e000-40870000 rw-p 0000f000 03:05 125198 /usr/java/j2re1.4.1_01/lib/i386/libverify.so
    40870000-40891000 r-xp 00000000 03:05 125186 /usr/java/j2re1.4.1_01/lib/i386/libjava.so
    40891000-40893000 rw-p 00020000 03:05 125186 /usr/java/j2re1.4.1_01/lib/i386/libjava.so
    40893000-408a8000 r-xp 00000000 03:05 125199 /usr/java/j2re1.4.1_01/lib/i386/libzip.so
    408a8000-408aa000 rw-p 00014000 03:05 125199 /usr/java/j2re1.4.1_01/lib/i386/libzip.so
    408aa000-41f78000 r--s 00000000 03:05 233155 /usr/java/j2re1.4.1_01/lib/rt.jar
    41fbb000-41fd2000 r--s 00000000 03:05 233156 /usr/java/j2re1.4.1_01/lib/sunrsasign.jar
    41fd2000-42043000 r--s 00000000 03:05 233149 /usr/java/j2re1.4.1_01/lib/jsse.jar
    42043000-42056000 r--s 00000000 03:05 233148 /usr/java/j2re1.4.1_01/lib/jce.jar
    42056000-42312000 r--s 00000000 03:05 233136 /usr/java/j2re1.4.1_01/lib/charsets.jar
    443ba000-443bb000 r-xp 00000000 03:05 125197 /usr/java/j2re1.4.1_01/lib/i386/librmi.so
    443bb000-443bc000 rw-p 00000000 03:05 125197 /usr/java/j2re1.4.1_01/lib/i386/librmi.so
    4c5c2000-4c5dd000 r--p 00000000 03:05 46541 /usr/lib/locale/en_US/LC_CTYPE
    4c5dd000-4c5e7000 r-xp 00000000 03:05 170595 /lib/libnss_files-2.2.2.so
    4c5e7000-4c5e8000 rw-p 00009000 03:05 170595 /lib/libnss_files-2.2.2.so
    4cb6d000-4cb7b000 r--s 00000000 03:05 78467 /usr/java/j2re1.4.1_01/lib/ext/ldapsec.jar
    4cb7b000-4cc1a000 r--s 00000000 03:05 78468 /usr/java/j2re1.4.1_01/lib/ext/localedata.jar
    4cc1a000-4cc37000 r--s 00000000 03:05 78469 /usr/java/j2re1.4.1_01/lib/ext/sunjce_provider.jar
    4cc37000-4cca8000 r--s 00000000 03:05 203220 /usr/local/avamar/lib/mcserver.jar
    4cca8000-4ccc0000 r--s 00000000 03:05 202934 /usr/local/avamar/lib/asn_server.jar
    4ccc0000-4cd05000 r--s 00000000 03:05 203213 /usr/local/avamar/lib/mail.jar
    4cd05000-4cd11000 r--s 00000000 03:05 202932 /usr/local/avamar/lib/activation.jar
    4cd11000-4cd28000 r--s 00000000 03:05 203210 /usr/local/avamar/lib/jdbc7.1-1.2.jar
    4cd28000-4cd38000 r-xp 00000000 03:05 125195 /usr/java/j2re1.4.1_01/lib/i386/libnet.so
    4cd38000-4cd3a000 rw-p 0000f000 03:05 125195 /usr/java/j2re1.4.1_01/lib/i386/libnet.so
    4ce14000-4ce1a000 r-xp 00000000 03:05 125196 /usr/java/j2re1.4.1_01/lib/i386/libnio.so
    4ce1a000-4ce1b000 rw-p 00005000 03:05 125196 /usr/java/j2re1.4.1_01/lib/i386/libnio.so
    4ce1b000-4ce25000 r-xp 00000000 03:05 170603 /lib/libnss_nisplus-2.2.2.so
    4ce25000-4ce27000 rw-p 00009000 03:05 170603 /lib/libnss_nisplus-2.2.2.so
    4ce27000-4ce2a000 r-xp 00000000 03:05 170592 /lib/libnss_dns-2.2.2.so
    4ce2a000-4ce2c000 rw-p 00002000 03:05 170592 /lib/libnss_dns-2.2.2.so
    4ce2c000-4ce3b000 r-xp 00000000 03:05 170608 /lib/libresolv-2.2.2.so
    4ce3b000-4ce3c000 rw-p 0000e000 03:05 170608 /lib/libresolv-2.2.2.so
    Local Time = Mon Jun 9 00:35:33 2003
    Elapsed Time = 873609
    # HotSpot Virtual Machine Error : 11
    # Error ID : 4F530E43505002E6
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Server VM (1.4.1_01-b01 mixed mode)
    These dumps mostly contain no stack information, and occur when the jvm makes calls into different libraries, mostly libc, libjvm, or pthread. The same problems occur with both java 1.4.1_01 and 1.4.1_02. Is there is any way to get java to provide more debug information or force it to core dump? Even though the message at the end of this error log that says to "report this error", Sun has not responded to any bug reports I have made. Any help would be appreciated.
    Thanks,
    Ed

    I think basically the answer is no, and even if you could I don't think it would help you much. A virtual machine error is exactly that, an error in the VM, not your code. The only thing I can suggest is that, if you want to see if your app is falling over in the same place every time, you use something like log4j.

  • Is there any way to limit the number of Threads running in Application(JVM)

    Hello all,
    is there any way to limit the number of Threads running in Application(JVM)?
    how to ensure that only 100 Threads are running in an Application?
    Thanks
    Mohamed Javeed

    You should definitely use a thread pool for this. You can specify maximum number of threads that can be run. Be note that the thread pool will only limit the number of threads that are submitted to it. So donot call "Thread"s start() method to start thread on your own. Submit it to the pool. To know more, study about executor service and thread pool creation. Actually it will not be more than 20 line code for a class and you might need maximum of 2 such classes, one for threadPool and other one for rejection handler (if you want).
    Just choose the queue used carefully, you just have to pass it as a parameter to the pool.
    You should use "Bounded" queue for limiting threads, but also be careful in using queues like SynchronizedQueue as the queue will execute immediately the threads submitted to it if maximum number of threads have not been running. Otherwise it will reject it and you should use rejection handler. So if your pool has a synchronized queue of size 100, if you submit 101th thread, it will be rejected and is not executed.
    If you want some kind of waiting mechanism, use something like LinkedBlockingQueue. What this will do is even if you want 100 threads, you can specify the queue's size to be 1000, so that you can submit 1000 threads, only 100 will run at a time and the remaining will wait in the queue. They will be executed when each thread already executing will complete. Rejection occurs only when the queue oveflows.

  • Any way to notify when a Thread terminate ?

    There's any way to notify (to other classes) when a thread terminate? Can I use an ActionEvent to notify that the thread is terminated ?
    Thank you
    Giorgio

    Hi,
    It depends what you're trying to do. A common occurrence is one thread waiting for another thread to complete. You can achieve this using the join() method on java.lang.Thread:
    Thread t = new Thread(new Runnable() {
    public void run()
    // do some long winded task A
    t.start();
    // do task B that will run concurrently with A
    // block this thread until task A completes
    t.join();
    (exception handling omitted for brevity)
    For general notification between threads, the wait() and notify() constructs are commonly used. These are called on an object and can only be called in code blocks synchronized on that object. There are a whole gammut of issues to be aware of when using threads in this way; I'd strongly recommend getting a good book on the subject (e.g. "Concurrent Programming in Java, Second Edition" by Doug Lea.
    null

  • Is there any way programmatically to disable the screen shot capture using Home   power button in the iPad device?

    Hi Team,
    Is there any way programmatically to disable the screen shot capture using Home + power button in the iPad device.We need to avoid the screen capture option due to security reason.
    thanks ,
    Bala

    Hi Peace, Clyde,
      Thanks for information. Using the API  UIApplicationUserDidTakeScreenhotNotification (iOS7)  send the notification after the screenshot taken.  Using this api is it possible to block the screen shot caputure option.
    Thanks and Regards,
    Bala

  • HT5824 Any way to recover Chrome bookmarks if I've had iCloud since they were lost? Google dumped my bookmarks.

    Any way to recover Chrome bookmarks if I've had iCloud on my PC, iPad and iPhone since before Google dumped them? Just noticed over thelast few days that my bookmarks were gone from iDevices, now I notice they're also gone from my PC.

    Hi Brian
    I had the same exact thing happen to me - except it was my wireless keyboard that disabled my ipad.  I also have documents on Pages that I did not want t to lose.  This worked for me!  Found it on another help site....I was able reactivate my ipad - nothing lost - all is good!
    1. Open iTunes with the iPad disconnected.
    2. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    3. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    4. Click ‘Setup as new iPad’ and then click restore.
    5. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    6. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    7. The first stage in the restore process unlocks the iPad, you are basically just cancelling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.

  • Is there any way to interrupt the sleeping thread ?

    Is there any way to interrupt the sleeping thread ?
    regards,
    namanc

    Thread.interrupt, very
    sneakily hidden by being in the javadocs under the
    class you know you're using, as a method named by what
    you want to do.:o)
    Here's more:
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

  • Any way to find the % of cycles a thread is using?

    without using a debugger or profiler,
    is there any way i can find out how many cycles my thread is active between two timestamps?
    or any way to find out the percentage of cycles my thread is active (compared to other threads)?

    oi, using native code is one of the main things i'm
    trying to avoid :) is there a way to find a threads
    CPU usage, or percentage thereof without having to use
    native code?There is no java api. So that means it is OS specific. You can't identify a specific thread using a process (via Runtime.exec) so that means the only solution is to use JNI.

  • Is there any way to load idml file into InDesign server Programmatically

    Hi,
         I am very new to InDesign Server development. I was able to load tagged text and generate image using InDesingServer Java APIs. Now I have new scenario to generate image. My scenario is to load an idml file into InDesign Server, then I need to generate an Image using this idml file.
         Is there any way to do this using InDesignServer Java APIs.
         Thanks in advance.
    Thanks,
    Ravi Kishore.CH

    I am not aware of a direct way of loading data from excel into
    oracle. I usually export the data into Access and then through
    ODBC save the data into a new table in the DB.
    Hope this helps.
    SUnder
    Raju Gorakhia (guest) wrote:
    : I am working on forms4.5 & i am looking for the method with
    : which i can directly access the xlsspreadsheet and upload into
    : some table into oracle database.
    : If there is no such method that how i will upload that
    : spreadsheet into the database?
    : Is there any way with which i can convert the variable lenght
    : file into fix length format with some specific delimitor so
    that
    : after that i can call sqlloader & upload that file into the
    : table?
    : Thanks Regards
    : Raju
    null

Maybe you are looking for

  • Flash player 10.3.1.8.34 (lastest verison)icon on my desktop ,does not work ?

    .I>m using windows7 OS IE9 downloaded and installed fifty times and it always say download and installation was sucessful ,that I"m now using flashplayer 10.5 ect. there is the flashplayer icon sitting right on my desktop .from control panel in progr

  • Need help with calculating interest

    Hey im trying to find out where my calculations are screwing up on the interest is coming up wrong but i am unable to find out where. After every month its suppose to be deposit - withdrawl * monthly interest rate and then add that total to the new m

  • Frequent Kernel Panics on MacBook Pro (Retina, 15-inch, Late 2013)

    My Macbook Pro is about 10 months old, and I've infrequently had kernel panics (about 3-4 a month) that began about 2 days after initial purchase. Is that often enough to be reason for concern? I'm asking because if there is a problem I'd hope to act

  • Null pointer exception in toString!

    Hi all, i am getting null pointer exception in toString method.Might be due to threads.Can i synchronize toString? The code snippent is as follows : @Override public String toString () if (mSourceInfo != null) return "Source [Name=" + mSourceInfo.nam

  • Problems with image and audio in Premiere

    Hi! I'm using Premiere Elements 9, but there's no synchronization with imagen and audio because the image is slower than audio and it's causing problems when I'm editing. Why can I do? It's there a poblem that can I fix in "Preferences" or is my lapt