jde.debugger
Class SessionManager

java.lang.Object
  |
  +--jde.debugger.SessionManager
All Implemented Interfaces:
Protocol

public class SessionManager
extends java.lang.Object
implements Protocol

The session manager keeps track of which debugging sessions are currently active and handled by which debuggers. There is also a special debug command handler thread which is handled by the SessionManager (#m_handler). It's a singleton object that exposes only a set of static interface functions.

Created: Tue Jan 08 13:19:51 2002

Version:
$Revision: 1.3 $
Author:
Petter Måhlén

Fields inherited from interface jde.debugger.Protocol
APP_IO, ATTACH_SHMEM, ATTACH_SOCKET, BR, BREAK, CANCEL_TRACE_CLASSES, CANCEL_TRACE_METHODS, CANCEL_TRACE_THREADS, CLEAR, CMD_NOK, CMD_OK, COMMAND_ERROR, COMMAND_RESULT, COMMANDS, 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, EVENTS, EVENTSET, EXCEPTION, EXIT, FINISH, FRAMEWORK, GET_ARRAY, GET_LOADED_CLASSES, GET_LOCALS, GET_OBJECT, GET_OBJECT_MONITORS, GET_PATH_INFORMATION, GET_STRING, GET_THREAD, GET_THREADS, GUI, INTERRUPT, INVALID, JDE_BUG, JDE_INIT_DEBUG_SESSION, JDE_PIPE, KILL_THREAD, LAUNCH, LISTEN_SHMEM, LISTEN_SOCKET, MESSAGE, NONE, NOQUOTE, QUIT, QUOTE, REPORT_IDS_IN_USE, RESUME, RUN, SPEC_RESOLVED, STEP, SUSPEND, TRACE_CLASSES, TRACE_EXCEPTIONS, TRACE_METHODS, TRACE_THREADS, WARNING, WATCH
 
Method Summary
static void deregisterDebugger(Debugger debugger)
          Deregisters the given debugger.
static java.lang.Long generateObjectID()
          Generates a unique number with each call (unique for each time that this class is loaded, not in any wider sense).
static CommandHandler getCommandHandler(java.lang.Integer procID)
          Returns the command handler for a given process ID.
static Debugger getDebugger(java.lang.Integer procID)
          Returns the Debugger object for a given process ID.
static void registerDebugger(Debugger debugger)
          Registers the given Debugger as active.
static void shutdown()
          Shuts down the SessionManager, by first shutting down each registered Debugger, and then shutting down the session command handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCommandHandler

public static CommandHandler getCommandHandler(java.lang.Integer procID)
                                        throws JDEException
Returns the command handler for a given process ID. Note that it doesn't return the Debugger object, but its command handler.
Parameters:
procID - an Integer value
Returns:
a CommandHandler value
Throws:
JDEException - if there is no registered debugger for the given process ID
See Also:
ProcessCommandHandler, Debugger

getDebugger

public static Debugger getDebugger(java.lang.Integer procID)
                            throws JDEException
Returns the Debugger object for a given process ID.
Parameters:
procID - an Integer value
Returns:
a Debugger value
Throws:
JDEException - if there is no registered debugger for the given process ID
See Also:
Debugger

registerDebugger

public static void registerDebugger(Debugger debugger)
                             throws JDEException
Registers the given Debugger as active. When this is done, it is possible to retrieve the Debugger and its CommandHandler through the getDebugger(java.lang.Integer) and getCommandHandler(java.lang.Integer) methods.
Parameters:
debugger - a Debugger value
Throws:
JDEException - if there is already a registered debugger with the same process ID.

deregisterDebugger

public static void deregisterDebugger(Debugger debugger)
                               throws JDEException
Deregisters the given debugger.
Parameters:
debugger - a Debugger value
Throws:
JDEException - if the debugger hasn't been registered previously, or if the debugger is still valid, as indicated by the Debugger.isValid() method.

shutdown

public static void shutdown()
Shuts down the SessionManager, by first shutting down each registered Debugger, and then shutting down the session command handler. After the shutdown, this object is no longer possible to use.

generateObjectID

public static java.lang.Long generateObjectID()
Generates a unique number with each call (unique for each time that this class is loaded, not in any wider sense).
Returns:
a Long value