| java.lang.Object com.sun.jdi.connect.spi.TransportService
TransportService | abstract public class TransportService (Code) | | A transport service for connections between a debugger and
a target VM.
A transport service is a concrete subclass of this class
that has a zero-argument constructor and implements the abstract
methods specified below. It is the underlying service
used by a
com.sun.jdi.connect.Transport for
connections between a debugger and a target VM.
A transport service is used to establish a connection
between a debugger and a target VM, and to transport Java
Debug Wire Protocol (JDWP) packets over an underlying
communication protocol. In essence a transport service
implementation binds JDWP (as specified in the
JDWP specification) to an underlying communication
protocol. A transport service implementation provides
a reliable JDWP packet transportation service. JDWP
packets are sent to and from the target VM without duplication
or data loss. A transport service implementation may be
based on an underlying communication protocol that is
reliable or unreliable. If the underlying communication
protocol is reliable then the transport service implementation
may be relatively simple and may only need to transport JDWP
packets as payloads of the underlying communication
protocol. In the case of an unreliable communication
protocol the transport service implementation may include
additional protocol support in order to ensure that packets
are not duplicated and that there is no data loss. The
details of such protocols are specific to the implementation
but may involve techniques such as the positive
acknowledgment with retransmission technique used in
protocols such as the Transmission Control Protocol (TCP)
(see RFC 793
).
A transport service can be used to initiate a connection
to a target VM. This is done by invoking the
TransportService.attach method. Alternatively, a transport service can listen and
accept connections initiated by a target VM. This is done
by invoking the
TransportService.startListening(String) method to
put the transport into listen mode. Then the
TransportService.accept method is used to accept a connection initiated by a
target VM.
since: 1.5 |
Inner Class :abstract public static class Capabilities | |
Inner Class :abstract public static class ListenKey | |
Method Summary | |
abstract public Connection | accept(ListenKey listenKey, long acceptTimeout, long handshakeTimeout) Accept a connection from a target VM.
Waits (indefinitely or with timeout) to accept a connection
from a target VM. | abstract public Connection | attach(String address, long attachTimeout, long handshakeTimeout) Attaches to the specified address.
Attaches to the specified address and returns a connection
representing the bi-directional communication channel to the
target VM. | abstract public Capabilities | capabilities() Returns the capabilities of the transport service. | abstract public String | description() Returns a description of the transport service. | abstract public String | name() Returns a name to identify the transport service. | abstract public ListenKey | startListening(String address) Listens on the specified address for inbound connections.
This method starts the transport service listening on
the specified address so that it can subsequently accept
an inbound connection. | abstract public ListenKey | startListening() Listens on an address choosen by the transport service.
This convenience method works as if by invoking
TransportService.startListening(String) startListening(null) . | abstract public void | stopListening(ListenKey listenKey) Stop listening for inbound connections.
Invoking this method while another thread is blocked
in
TransportService.accept accept , with the same listen key,
waiting to accept a connection will cause that thread to
throw an IOException. |
accept | abstract public Connection accept(ListenKey listenKey, long acceptTimeout, long handshakeTimeout) throws IOException(Code) | | Accept a connection from a target VM.
Waits (indefinitely or with timeout) to accept a connection
from a target VM. Returns a connection representing the
bi-directional communication channel to the target VM.
Accepting a connection from a target VM involves two
steps. First, the transport service waits to accept
the connection from the target VM. Once the connection is
established a handshake is performed to ensure that the
connection is indeed to a target VM. The handshake involves
the exchange of a string JDWP-Handshake as specified
in the
Java Debug Wire Protocol specification.
Parameters: listenKey - A listen key obtained from a previous call to TransportService.startListening(String) or TransportService.startListening(). Parameters: acceptTimeout - if this transport service supports an accept timeout, andif acceptTimeout is positive then block for up toacceptTimeout milliseconds, more or less, while waitingfor the target VM to connect.If the transport service does not support an accept timeoutor if acceptTimeout is zero then block indefinitelyfor a target VM to connect. Parameters: handshakeTimeout - If this transport service supports a handshake timeout,and if handshakeTimeout is positive, then itspecifies the timeout, in milliseconds (more or less), touse when handshaking with the target VM. The exactusage of the timeout is specific to the transport service.A transport service may, for example, use the handshaketimeout as the inter-character timeout while waiting forthe JDWP-Handshake message from the target VM.Alternatively, a transport service may, for example,use the timeout as a timeout for the duration of thehandshake exchange.If the transport service does not support a handshaketimeout, of if handshakeTimeout is specifiedas zero then the handshake does not timeout if thereisn't a response from the target VM. The Connection representing the bi-directionalcommunication channel to the target VM. throws: TransportTimeoutException - If a timeout occurs while waiting for a target VMto connect. throws: IOException - If an I/O error occurs (including a timeout whenhandshaking). throws: IllegalArgumentException - If the value of the acceptTimeout argument, orhandshakeTimeout is negative, or an invalid listen keyis provided. throws: IllegalStateException - If TransportService.stopListening stopListening has already beencalled with this listen key and the transport serviceis no longer listening for inbound connections. See Also: TransportService.Capabilities.supportsAcceptTimeout |
attach | abstract public Connection attach(String address, long attachTimeout, long handshakeTimeout) throws IOException(Code) | | Attaches to the specified address.
Attaches to the specified address and returns a connection
representing the bi-directional communication channel to the
target VM.
Attaching to the target VM involves two steps:
First, a connection is established to specified address. This
is followed by a handshake to ensure that the connection is
to a target VM. The handshake involves the exchange
of a string JDWP-Handshake as specified in the
Java Debug Wire Protocol specification.
Parameters: address - The address of the target VM. Parameters: attachTimeout - If this transport service supports an attach timeout,and if attachTimeout is positive, then it specifiesthe timeout, in milliseconds (more or less), to usewhen attaching to the target VM. If the transport servicedoes not support an attach timeout, or if attachTimeoutis specified as zero then attach without any timeout. Parameters: handshakeTimeout - If this transport service supports a handshake timeout,and if handshakeTimeout is positive, then itspecifies the timeout, in milliseconds (more or less), touse when handshaking with the target VM. The exactusage of the timeout are specific to the transport service.A transport service may, for example, use the handshaketimeout as the inter-character timeout while waiting forthe JDWP-Handshake message from the target VM.Alternatively, a transport service may, for example,use the handshakeTimeout as a timeout for the duration of thehandshake exchange. If the transport service does not support a handshaketimeout, or if handshakeTimeout is specified as zero then the handshake does not timeout if thereisn't a response from the target VM. The Connection representing the bi-directionalcommunication channel to the target VM. throws: TransportTimeoutException - If a timeout occurs while establishing the connection. throws: IOException - If an I/O error occurs (including a timeout whenhandshaking). throws: IllegalArgumentException - If the address is invalid or the value of theattach timeout or handshake timeout is negative. See Also: TransportService.Capabilities.supportsAttachTimeout |
capabilities | abstract public Capabilities capabilities()(Code) | | Returns the capabilities of the transport service.
the transport service capabilities |
description | abstract public String description()(Code) | | Returns a description of the transport service.
The description of the transport service |
name | abstract public String name()(Code) | | Returns a name to identify the transport service.
The name of the transport service |
startListening | abstract public ListenKey startListening(String address) throws IOException(Code) | | Listens on the specified address for inbound connections.
This method starts the transport service listening on
the specified address so that it can subsequently accept
an inbound connection. It does not wait until an inbound
connection is established.
Parameters: address - The address to start listening for connections,or null to listen on an address choosenby the transport service. a listen key to be used in subsequent calls to be TransportService.accept accept or TransportService.stopListeningstopListening methods. throws: IOException - If an I/O error occurs. throws: IllegalArgumentException - If the specific address is invalid |
stopListening | abstract public void stopListening(ListenKey listenKey) throws IOException(Code) | | Stop listening for inbound connections.
Invoking this method while another thread is blocked
in
TransportService.accept accept , with the same listen key,
waiting to accept a connection will cause that thread to
throw an IOException. If the thread blocked in accept
has already accepted a connection from a target VM and
is in the process of handshaking with the target VM then
invoking this method will not cause the thread to throw
an exception.
Parameters: listenKey - The listen key obtained from a previous call to TransportService.startListening(String) or TransportService.startListening(). throws: IllegalArgumentException - If the listen key is invalid throws: IOException - If an I/O error occurs. |
|
|