Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can attach the debugger to a java process and set a breakpoint when a specific exception is received. Is this what you need?</p> <p>From <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html</a></p> <blockquote> <p>When an exception occurs for which there isn't a catch statement anywhere up a Java program's stack, the Java runtime normally dumps an exception trace and exits. When running under jdb, however, that exception is treated as a non-recoverable breakpoint, and jdb stops at the offending instruction. If that class was compiled with the -g option, instance and local variables can be printed to determine the cause of the exception.</p> </blockquote> <p>This type of breakpoints can be set with any IDE, such as Eclipse. Using eclipse you can also set a breakpoint on a specific exception type, even if it is caught in the normal code.</p> <p>If you have something like a multi-threaded server running, and one of the threads servicing a client throws an unhandled exception, then you would be able to check the debugger and see what happens. I don't think this is something for production, but definitively helps when testing.</p> <p>The application does not have to run from the debugger, but it can be launched with the debug options as arguments:</p> <pre><code>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=XXXX </code></pre> <p>The application runs normally, but switches into "interpreted" mode when a breakpoint is hit, at least in more modern versions of the JVM. So the performance is not affected.</p> <p>Check the section about <a href="http://java.sun.com/products/hotspot/docs/whitepaper/Java_Hotspot_v1.4.1/Java_HSpot_WP_v1.4.1_1002_1.html" rel="nofollow noreferrer">full-speed debugging for HotSpot VM</a></p> <blockquote> <p>Full Speed Debugging</p> <p>The Java HotSpot VM now uses full-speed debugging. In previous version of the VM, when debugging was enabled, the program executed using only the interpreter. Now, the full performance advantage of HotSpot technology is available to programs, even with compiled code. The improved performance allows long-running programs to be more easily debugged. It also allows testing to proceed at full speed. Once there is an exception, the debugger launches with full visibility to code sources.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload