2 * Copyright (c) 2000, 2001, 2003 Paul Kinnucan
7 package jde.debugger.command;
8 import java.util.Iterator;
10 import com.sun.jdi.ObjectReference;
11 import com.sun.jdi.ThreadGroupReference;
12 import com.sun.jdi.ThreadReference;
13 import jde.debugger.Etc;
14 import jde.debugger.JDEException;
28 * <li> threadIDs can be retrieved using the get_threads command
29 * <li> if the list is omitted, the entire VM is resumed
30 * <li> threadIDs can refer to either threads or thereadgroups.
33 * @author Paul Kinnucan
34 * @version $Revision: 1.2 $
35 * @copyright Copyright (c) 2000, 2001, 2003 Paul Kinnucan
38 public class Resume extends DebugProcessCommand {
42 * @exception jde.debugger.JDEException <description>
44 public void doCommand() throws JDEException {
45 // see if there are arguments (should be the thread id). if so, we
46 // resume the thread ids passed. else, resume the whole vm.
47 if (m_args.size() > 0) {
48 Iterator it = m_args.iterator();
49 while (it.hasNext()) {
50 Long uniqueID = Etc.safeGetLong(it.next(), "thread(group)");
52 ObjectReference oRef = (ObjectReference) m_debugger.getStore().get(uniqueID);
54 throw new JDEException("Invalid ThreadID, or the thread/threadgroup is dead");
55 } else if (oRef instanceof ThreadReference) {
56 ((ThreadReference)oRef).resume();
57 } else if (oRef instanceof ThreadGroupReference) {
58 ((ThreadGroupReference)oRef).resume();
60 throw new JDEException("The object is not a thread or a threadgroup");
63 m_debugger.signalCommandResult(m_cmdID, null, CMD_OK);
66 m_debugger.getVM().resume();
67 m_debugger.signalCommandResult(m_cmdID, null, CMD_OK);
68 } catch (Exception ex) {
69 throw new JDEException("Unable to resume the application");
74 public Object clone() {return new Resume();}
79 * $Log: Resume.java,v $
80 * Revision 1.2 2003/01/15 05:56:26 paulk
81 * Add Petter Mahlen's changes.
83 * Revision 1.1 2001/03/24 13:35:25 paulk