2
|
1 |
/*
|
45564
|
2 |
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.jdi.connect;
|
|
27 |
|
45564
|
28 |
import java.io.IOException;
|
2
|
29 |
import java.util.Map;
|
45564
|
30 |
|
2
|
31 |
import com.sun.jdi.VirtualMachine;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* A connector which listens for a connection initiated by a target VM.
|
|
35 |
*
|
|
36 |
* @author Gordon Hirsch
|
|
37 |
* @since 1.3
|
|
38 |
*/
|
|
39 |
public interface ListeningConnector extends Connector {
|
45564
|
40 |
|
2
|
41 |
/**
|
|
42 |
* Indicates whether this listening connector supports multiple
|
|
43 |
* connections for a single argument map. If so, a call to
|
|
44 |
* {@link #startListening} may allow
|
|
45 |
* multiple target VM to become connected.
|
|
46 |
*
|
|
47 |
* @return <code>true</code> if multiple connections are supported;
|
|
48 |
* <code>false</code> otherwise.
|
|
49 |
*/
|
|
50 |
boolean supportsMultipleConnections();
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Listens for one or more connections initiated by target VMs.
|
|
54 |
* The connector uses the given argument map
|
|
55 |
* in determining the address at which to listen or else it generates
|
|
56 |
* an appropriate listen address. In either case, an address string
|
|
57 |
* is returned from this method which can be used in starting target VMs
|
|
58 |
* to identify this connector. The format of the address string
|
|
59 |
* is connector, transport, and, possibly, platform dependent.
|
|
60 |
* <p>
|
|
61 |
* The argument map associates argument name strings to instances
|
|
62 |
* of {@link Connector.Argument}. The default argument map for a
|
|
63 |
* connector can be obtained through {@link Connector#defaultArguments}.
|
|
64 |
* Argument map values can be changed, but map entries should not be
|
|
65 |
* added or deleted.
|
|
66 |
* <p>
|
|
67 |
* This method does not return a {@link VirtualMachine}, and, normally,
|
|
68 |
* returns before any target VM initiates
|
|
69 |
* a connection. The connected target is obtained through
|
|
70 |
* {@link #accept} (using the same argument map as is passed to this
|
|
71 |
* method).
|
|
72 |
* <p>
|
|
73 |
* If <code>arguments</code> contains addressing information. and
|
21278
|
74 |
* only one connection will be accepted, the {@link #accept accept} method
|
2
|
75 |
* can be called immediately without calling this method.
|
|
76 |
*
|
|
77 |
* @return the address at which the connector is listening
|
|
78 |
* for a connection.
|
|
79 |
* @throws java.io.IOException when unable to start listening.
|
|
80 |
* Specific exceptions are dependent on the Connector implementation
|
|
81 |
* in use.
|
|
82 |
* @throws IllegalConnectorArgumentsException when one of the
|
|
83 |
* connector arguments is invalid.
|
|
84 |
*/
|
|
85 |
String startListening(Map<String,? extends Connector.Argument> arguments)
|
|
86 |
throws IOException, IllegalConnectorArgumentsException;
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Cancels listening for connections. The given argument map should match
|
|
90 |
* the argument map given for a previous {@link #startListening} invocation.
|
|
91 |
*
|
|
92 |
* @throws java.io.IOException when unable to stop listening.
|
|
93 |
* Specific exceptions are dependent on the Connector implementation
|
|
94 |
* in use.
|
|
95 |
* @throws IllegalConnectorArgumentsException when one of the
|
|
96 |
* connector arguments is invalid.
|
|
97 |
*/
|
|
98 |
void stopListening(Map<String,? extends Connector.Argument> arguments)
|
|
99 |
throws IOException, IllegalConnectorArgumentsException;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Waits for a target VM to attach to this connector.
|
|
103 |
*
|
|
104 |
* @throws TransportTimeoutException when the Connector encapsulates
|
|
105 |
* a transport that supports a timeout when accepting, a
|
|
106 |
* {@link Connector.Argument} representing a timeout has been set
|
|
107 |
* in the argument map, and a timeout occurs whilst waiting for
|
|
108 |
* the target VM to connect.
|
|
109 |
* @throws java.io.IOException when unable to accept.
|
|
110 |
* Specific exceptions are dependent on the Connector implementation
|
|
111 |
* in use.
|
|
112 |
* @throws IllegalConnectorArgumentsException when one of the
|
|
113 |
* connector arguments is invalid.
|
|
114 |
*/
|
|
115 |
VirtualMachine accept(Map<String,? extends Connector.Argument> arguments)
|
|
116 |
throws IOException, IllegalConnectorArgumentsException;
|
|
117 |
}
|