1 /*
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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 *
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.
24 */
25
26 package com.sun.jdi.connect;
27
28 import java.util.Map;
29 import java.io.IOException;
30 import com.sun.jdi.VirtualMachine;
31
32 /**
33 * A connector which listens for a connection initiated by a target VM.
34 *
35 * @author Gordon Hirsch
36 * @since 1.3
37 */
38 public interface ListeningConnector extends Connector {
39 /**
40 * Indicates whether this listening connector supports multiple
41 * connections for a single argument map. If so, a call to
42 * {@link #startListening} may allow
43 * multiple target VM to become connected.
44 *
45 * @return <code>true</code> if multiple connections are supported;
46 * <code>false</code> otherwise.
47 */
48 boolean supportsMultipleConnections();
49
50 /**
51 * Listens for one or more connections initiated by target VMs.
52 * The connector uses the given argument map
53 * in determining the address at which to listen or else it generates
54 * an appropriate listen address. In either case, an address string
55 * is returned from this method which can be used in starting target VMs
56 * to identify this connector. The format of the address string
57 * is connector, transport, and, possibly, platform dependent.
58 * <p>
79 * in use.
80 * @throws IllegalConnectorArgumentsException when one of the
81 * connector arguments is invalid.
82 */
83 String startListening(Map<String,? extends Connector.Argument> arguments)
84 throws IOException, IllegalConnectorArgumentsException;
85
86 /**
87 * Cancels listening for connections. The given argument map should match
88 * the argument map given for a previous {@link #startListening} invocation.
89 *
90 * @throws java.io.IOException when unable to stop listening.
91 * Specific exceptions are dependent on the Connector implementation
92 * in use.
93 * @throws IllegalConnectorArgumentsException when one of the
94 * connector arguments is invalid.
95 */
96 void stopListening(Map<String,? extends Connector.Argument> arguments)
97 throws IOException, IllegalConnectorArgumentsException;
98
99
100 /**
101 * Waits for a target VM to attach to this connector.
102 *
103 * @throws TransportTimeoutException when the Connector encapsulates
104 * a transport that supports a timeout when accepting, a
105 * {@link Connector.Argument} representing a timeout has been set
106 * in the argument map, and a timeout occurs whilst waiting for
107 * the target VM to connect.
108 * @throws java.io.IOException when unable to accept.
109 * Specific exceptions are dependent on the Connector implementation
110 * in use.
111 * @throws IllegalConnectorArgumentsException when one of the
112 * connector arguments is invalid.
113 */
114 VirtualMachine accept(Map<String,? extends Connector.Argument> arguments)
115 throws IOException, IllegalConnectorArgumentsException;
116
117 }
|
1 /*
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
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 *
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.
24 */
25
26 package com.sun.jdi.connect;
27
28 import java.io.IOException;
29 import java.util.Map;
30
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 {
40
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>
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 }
|