"

2013 FRC Java API

"

com.sun.squawk.debugger
Class JDWPListener

java.lang.Object
  extended by com.sun.squawk.debugger.JDWPListener
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
SDPListener

public abstract class JDWPListener
extends Object
implements Runnable

A JDWPListener receives and processes JDWP requests from a remote debugger entity on behalf of a local debugger entity. The JDWPListener manages a JDWPConnection used to communicate with the remote entity.


Nested Class Summary
static class JDWPListener.CommandSet
          The implementation of each JDWP Command Set subclasses this class.
static class JDWPListener.QuitException
          A QuitException is thrown by #waitForCommand and #waitForReply if this listener quits before receving the relevant packet.
 
Field Summary
protected  JDWPListener otherHost
          The connection to the other host participating in a network connection that is being proxied.
 
Constructor Summary
JDWPListener()
          Creats a JDWPListener.
 
Method Summary
 void bindProxyPeer(JDWPListener p)
          Binds this connection with the connection to the other host participating in a proxied JDWP/SDWP debug session.
 PacketInputStream getInputStreamFor(CommandPacket command)
          Get the input stream from a command packet (sniffer needs to wrap input stream.
 boolean hasQuit()
          Determines if this listener has quit.
 void open(String url, byte[] handshake, boolean initiate, boolean isJDB, Runnable delayer)
          Opens the connection used by this listener and performs a handshake with the remote host once the connection has been established.
protected abstract  void processCommand(CommandPacket command)
          Processes a single command received over this listeners connection.
 boolean quit()
          Stops this listener's run loop
 void run()
          When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.
 ReplyPacket sendCommand(CommandPacket command)
          Sends a command packet over this connection.
 void sendReply(ReplyPacket reply)
           
abstract  String sourceName()
          Subclasses must return a meaning name for this listener that will be useful as a suffix for log messages on this thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

otherHost

protected JDWPListener otherHost
The connection to the other host participating in a network connection that is being proxied.

Constructor Detail

JDWPListener

public JDWPListener()
Creats a JDWPListener.

Method Detail

bindProxyPeer

public void bindProxyPeer(JDWPListener p)
Binds this connection with the connection to the other host participating in a proxied JDWP/SDWP debug session.

Parameters:
p - the connection to the other host

open

public void open(String url,
                 byte[] handshake,
                 boolean initiate,
                 boolean isJDB,
                 Runnable delayer)
          throws IOException
Opens the connection used by this listener and performs a handshake with the remote host once the connection has been established.

Parameters:
url - the URL for opening the connection
handshake - an array of bytes that must be exchanged in each direction to complete a handshake
initiate - true if the handshake is to be intiated by this host
isJDB -
delayer - code to run after connection but before handshake
Throws:
IOException - if the connection could not be opened or if the handshake was not successful

processCommand

protected abstract void processCommand(CommandPacket command)
                                throws IOException
Processes a single command received over this listeners connection.

Parameters:
command -
Throws:
IOException

run

public final void run()
Description copied from interface: Runnable
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

The general contract of the method run is that it may take any action whatsoever.

Specified by:
run in interface Runnable
See Also:
Thread.run()

sendCommand

public final ReplyPacket sendCommand(CommandPacket command)
                              throws IOException,
                                     SDWPException
Sends a command packet over this connection. If the command needs a reply, the current thread blocks until the reply has been received.

Parameters:
command - the command packet to send
Returns:
reply to the command
Throws:
IOException - if there was an IO error while sending the packet
IllegalStateException - if called before the listener has set up a connection and waited for connection to be ready for packets.
SDWPException - if the received reply has a non-zero error code

sendReply

public final void sendReply(ReplyPacket reply)
                     throws IOException
Throws:
IOException

quit

public boolean quit()
Stops this listener's run loop

Returns:
true if this method had already been called (i.e. the listener has already been requested to quit)

hasQuit

public boolean hasQuit()
Determines if this listener has quit.

Returns:
boolean

sourceName

public abstract String sourceName()
Subclasses must return a meaning name for this listener that will be useful as a suffix for log messages on this thread.

Returns:
the name of the thing that this listener is talking to.

getInputStreamFor

public PacketInputStream getInputStreamFor(CommandPacket command)
Get the input stream from a command packet (sniffer needs to wrap input stream.

Parameters:
command - packet to read from
Returns:
the input stream to read with

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"