Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jde.debugger
Class ThreadCommands

    java.lang.Object
      |
      +--jde.debugger.ApplicationCommands
            |
            +--jde.debugger.ThreadCommands

All Implemented Interfaces:
  Protocol

public class ThreadCommands
extends ApplicationCommands

ThreadCommands.java

Handles thread related commands. Jump to '`suspend`', `resume`', '`interrupt`', `kill_thread`, '`get_thread`', '`get_thread`', '`get_object_monitors`', '`trace_threads`', '`cancel_trace_threads`'

Created: Fri Jul 30 16:04:07 1999

Since:
  0.1
Author:
  Amit Kumar

Fields inherited from class jde.debugger.ApplicationCommands
`app, identifiableEventRequests, store`

Fields inherited from interface jde.debugger.Protocol
`ATTACH_SHMEM, ATTACH_SOCKET, BR, BREAK, CANCEL_TRACE_CLASSES, CANCEL_TRACE_METHODS, CANCEL_TRACE_THREADS, CLEAR, COMMAND_ERROR, COMMAND_RESULT, CONNECTED_TO_VM, DEBUG, ERROR, EVALUATE, EVENT_BREAKPOINT_HIT, EVENT_CLASS_PREPARE, EVENT_CLASS_UNLOAD, EVENT_EXCEPTION, EVENT_METHOD_ENTRY, EVENT_METHOD_EXIT, EVENT_OTHER, EVENT_STEP_COMPLETED, EVENT_THREAD_DEATH, EVENT_THREAD_START, EVENT_VM_DEATH, EVENT_VM_DISCONNECT, EVENT_VM_START, EVENT_WATCHPOINT_HIT, EVENTSET, EXIT, FINISH, GET_ARRAY, GET_LOADED_CLASSES, GET_LOCALS, GET_OBJECT, GET_OBJECT_MONITORS, GET_PATH_INFORMATION, GET_STRING, GET_THREAD, GET_THREADS, INTERRUPT, INVALID, JDE_BUG, JDE_INIT_DEBUG_SESSION, KILL_THREAD, LAUNCH, LISTEN_SHMEM, LISTEN_SOCKET, MESSAGE, QUIT, REPORT_IDS_IN_USE, RESUME, RUN, SPEC_RESOLVED, STEP, SUSPEND, TRACE_CLASSES, TRACE_EXCEPTIONS, TRACE_METHODS, TRACE_THREADS, WARNING, WATCH`

Constructor Summary
`ThreadCommands(Application a, ObjectStore s)`

Method Summary
`void` | `doCancelTraceThreads(java.lang.Integer cmd_id, java.util.List args)` 'cancel_trace_threads' command.
`void` | `doGetObjectMonitors(java.lang.Integer cmd_id, java.util.List args)` 'get_object_monitors' command.
`void` | `doGetThread(java.lang.Integer cmd_id, java.util.List args)` 'get_thread' command.
`void` | `doGetThreads(java.lang.Integer cmd_id, java.util.List args)` List all threads.
`void` | `doInterrupt(java.lang.Integer cmd_id, java.util.List args)` 'interrupt' command.
`void` | `doKillThread(java.lang.Integer cmd_id, java.util.List args)` 'kill' command.
`void` | `doResume(java.lang.Integer cmd_id, java.util.List args)` 'resume' command.
`void` | `doSuspend(java.lang.Integer cmd_id, java.util.List args)` 'suspend' command.
`void` | `doTraceThreads(java.lang.Integer cmd_id, java.util.List args)` 'trace_threads' command.
`(package private) static LispForm` | `getAllThreadsInformation(com.sun.jdi.VirtualMachine vm, ObjectStore store)` Returns a representation of all the threads and threadgroups in the VM.
`(package private) static com.sun.jdi.ThreadReference` | `getThread(com.sun.jdi.VirtualMachine vm, java.lang.String name)` Returns the thread corresponding to this name

Methods inherited from class jde.debugger.ApplicationCommands
`addIdentifiableRequest, deleteIdentifiableRequest`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Constructor Detail

### ThreadCommands

    public ThreadCommands(Application a,
                          ObjectStore s)

Method Detail

### doSuspend

    public void doSuspend(java.lang.Integer cmd_id,
                          java.util.List args)
                   throws JDEException

  'suspend' command.

  Syntax:

       suspend [threadID]*

  Comments:
  - threadIDs can be retrieved using the get_threads command
  - if the list is omitted, the entire VM is suspended
  - threadIDs can refer to either threads or threadgroups.

### doResume

    public void doResume(java.lang.Integer cmd_id,
                         java.util.List args)
                  throws JDEException

  'resume' command.

  Syntax:

       resume [threadID]*

  Comments:
  - threadIDs can be retrieved using the get_threads command
  - if the list is omitted, the entire VM is resumed
  - threadIDs can refer to either threads or thereadgroups.

### doInterrupt

    public void doInterrupt(java.lang.Integer cmd_id,
                            java.util.List args)
                     throws JDEException

  'interrupt' command.

  Syntax:

       interrupt [threadID]+

  Comments:
  - threadID can be retrieved using the get_threads command
  - at least one threadId should be specified

### doKillThread

    public void doKillThread(java.lang.Integer cmd_id,
                             java.util.List args)
                      throws JDEException

  'kill' command. Kill a thread with a given exception object.

  Syntax:

       kill_thread threadID exceptionObjectID

  Comments:
  - threadID can be retrieved using the get_threads command
  - exceptionObjectID is the object id of a Throwable object. It can be created using the 'evaluate' command, or an existing throwable object can be used.

### doGetThreads

    public void doGetThreads(java.lang.Integer cmd_id,
                             java.util.List args)
                      throws JDEException

  List all threads. 'get_threads' command.

  Syntax:

       get_threads

  Returns:

       (jde-dbo-command-result cmd_id thread-info)

  Comments:
  - There are a couple of quirks regarding the reporting of thread state:
    - Quirk 1: Due to a bug in ThreadReference.isAtBreakpoint(), a thread will report a breakpoint at a location even if a threadFilter has been applied for the thread. ie, if test.Test.java:41 is your breakpoint, and you've applied a threadfilter saying you DON'T want an event if the thread == Thread-A, and you somehow suspend Thread-A at exactly that line, and do a 'get_threads'; Thread-A will report to be suspended on a breakpoint, although ordinarily it would have skipped it.
    - Quirk 2: There seems to be no way of reporting the status if the user does a Thread.suspend(). Well, it's deprecated anyways... *shrug*.

### getAllThreadsInformation

    static LispForm getAllThreadsInformation(com.sun.jdi.VirtualMachine vm,
                                             ObjectStore store)

  Returns a representation of all the threads and threadgroups in the VM. For example:

                    ThreadGroup-1
                        +- ThreadGroup-2
                        |        +- ThreadGroup-3
                        |        |        \- Thread-1
                        |        +- ThreadGroup-4
                        |        |        +- Thread-2
                        |        |        \- Thread-3
                        |        \- Thread-4
                        \- Thread-5
                    ThreadGroup-5
                        +- Thread-6

                (list
                  (list "ThreadGroup"  "ThreadGroup-1"
                    (list
                      (list "Thread"  "Thread-5" ...))
                    (list
                      (list "ThreadGroup"  "ThreadGroup-2"
                        (list
                          (list "Thread"  "Thread-4"))
                        (list
                          (list "ThreadGroup"  "ThreadGroup-3"
                            (list)
                            (list
                              (list "Thread"  "Thread-1" ...)))
                          (list "ThreadGroup"  "ThreadGroup-4"
                            (list)
                              (list
                                (list "Thread"  "Thread-2" ...)
                                (list "Thread"  "Thread-3" ...)))))))
                (list "ThreadGroup"  "ThreadGroup-5"
                  (list)
                    (list
                      (list "Thread"  "Thread-6" ...))))

  Syntax:

       (list [top-level thread group]*)

  Parameters:
    `vm` - The virtual machine itself
    `store` - The object store where you should keep references to the thread ids. For details, see `ObjectStore`

### getThread

    static com.sun.jdi.ThreadReference getThread(com.sun.jdi.VirtualMachine vm,
                                                 java.lang.String name)

  Returns the thread corresponding to this name

### doGetThread

    public void doGetThread(java.lang.Integer cmd_id,
                            java.util.List args)
                     throws JDEException

  'get_thread' command. List a thread in more detail.

  Syntax:

       get_thread threadID

  Returns:

       (jde-dbo-command-result cmd_id detailed-thread-info)

  Comments:
  - The thread can be waiting for a monitor through entry into a synchronized method, the synchronized statement, or Object.wait(). The status() method can be used to differentiate between the first two cases and the third.

### doGetObjectMonitors

    public void doGetObjectMonitors(java.lang.Integer cmd_id,
                                    java.util.List args)
                             throws JDEException

  'get_object_monitors' command. Information about the monitors corresponding to a particular object.

  Syntax:

       get_object_monitors objectID

  Returns:

       (jde-dbo-command-result cmd_id object-monitors-info)

### doTraceThreads

    public void doTraceThreads(java.lang.Integer cmd_id,
                               java.util.List args)
                        throws JDEException

  'trace_threads' command.

  Syntax:

       trace_threads type [threadID]
            [suspend-policy]

  Comments:
  - type can be either "start" or "death"
  - If no threadID is specified, all the corresponding thread events are raised.

  See Also:
    `EventHandler.threadStartEvent(ThreadStartEvent)`, `EventHandler.threadDeathEvent(ThreadDeathEvent)`

### doCancelTraceThreads

    public void doCancelTraceThreads(java.lang.Integer cmd_id,
                                     java.util.List args)
                              throws JDEException

  'cancel_trace_threads' command.

  Syntax:

       cancel_trace_threads requestID

  Comments:
  - requestID is returned in the trace threads reply

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD