author | rfield |
Wed, 21 Dec 2016 20:14:39 -0800 | |
changeset 42969 | a48d4f74d322 |
parent 42272 | 82e273c4f2b3 |
child 43758 | 868af3718a21 |
permissions | -rw-r--r-- |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
1 |
/* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
4 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
10 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
15 |
* accompanied this code). |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
16 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
20 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
23 |
* questions. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
24 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
25 |
package jdk.jshell.execution; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
26 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
27 |
import java.io.File; |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
28 |
import java.io.IOException; |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
29 |
import java.util.ArrayList; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
30 |
import java.util.HashMap; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
31 |
import java.util.List; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
32 |
import java.util.Map; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
33 |
import java.util.Map.Entry; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
34 |
import com.sun.jdi.Bootstrap; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
35 |
import com.sun.jdi.VirtualMachine; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
36 |
import com.sun.jdi.connect.Connector; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
37 |
import com.sun.jdi.connect.LaunchingConnector; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
38 |
import com.sun.jdi.connect.ListeningConnector; |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
39 |
import java.util.concurrent.Callable; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
40 |
import java.util.concurrent.ExecutorService; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
41 |
import java.util.concurrent.Executors; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
42 |
import java.util.concurrent.Future; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
43 |
import java.util.concurrent.TimeUnit; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
44 |
import java.util.concurrent.TimeoutException; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
45 |
import com.sun.jdi.connect.IllegalConnectorArgumentsException; |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
46 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
47 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
48 |
* Sets up a JDI connection, providing the resulting JDI {@link VirtualMachine} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
49 |
* and the {@link Process} the remote agent is running in. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
50 |
*/ |
41941
a935ac3f5274
8161983: JShell API: Clean-up following 8160127 et. al.
rfield
parents:
40764
diff
changeset
|
51 |
public class JdiInitiator { |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
52 |
|
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
53 |
// factor for the timeout on all of connect |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
54 |
private static final double CONNECT_TIMEOUT_FACTOR = 1.5; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
55 |
|
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
56 |
// Over-all connect time-out |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
57 |
private final int connectTimeout; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
58 |
|
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
59 |
private VirtualMachine vm; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
60 |
private Process process = null; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
61 |
private final Connector connector; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
62 |
private final String remoteAgent; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
63 |
private final Map<String, com.sun.jdi.connect.Connector.Argument> connectorArgs; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
64 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
65 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
66 |
* Start the remote agent and establish a JDI connection to it. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
67 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
68 |
* @param port the socket port for (non-JDI) commands |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
69 |
* @param remoteVMOptions any user requested VM options |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
70 |
* @param remoteAgent full class name of remote agent to launch |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
71 |
* @param isLaunch does JDI do the launch? That is, LaunchingConnector, |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
72 |
* otherwise we start explicitly and use ListeningConnector |
40764
29ded021f809
8164518: JShell: Add failover case of explicitly listening to "localhost"
rfield
parents:
39807
diff
changeset
|
73 |
* @param host explicit hostname to use, if null use discovered |
29ded021f809
8164518: JShell: Add failover case of explicitly listening to "localhost"
rfield
parents:
39807
diff
changeset
|
74 |
* hostname, applies to listening only (!isLaunch) |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
75 |
* @param timeout the start-up time-out in milliseconds |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
76 |
*/ |
41941
a935ac3f5274
8161983: JShell API: Clean-up following 8160127 et. al.
rfield
parents:
40764
diff
changeset
|
77 |
public JdiInitiator(int port, List<String> remoteVMOptions, String remoteAgent, |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
78 |
boolean isLaunch, String host, int timeout) { |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
79 |
this.remoteAgent = remoteAgent; |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
80 |
this.connectTimeout = (int) (timeout * CONNECT_TIMEOUT_FACTOR); |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
81 |
String connectorName |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
82 |
= isLaunch |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
83 |
? "com.sun.jdi.CommandLineLaunch" |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
84 |
: "com.sun.jdi.SocketListen"; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
85 |
this.connector = findConnector(connectorName); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
86 |
if (connector == null) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
87 |
throw new IllegalArgumentException("No connector named: " + connectorName); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
88 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
89 |
Map<String, String> argumentName2Value |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
90 |
= isLaunch |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
91 |
? launchArgs(port, String.join(" ", remoteVMOptions)) |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
92 |
: new HashMap<>(); |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
93 |
if (!isLaunch) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
94 |
argumentName2Value.put("timeout", ""+timeout); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
95 |
if (host != null && !isLaunch) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
96 |
argumentName2Value.put("localAddress", host); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
97 |
} |
40764
29ded021f809
8164518: JShell: Add failover case of explicitly listening to "localhost"
rfield
parents:
39807
diff
changeset
|
98 |
} |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
99 |
this.connectorArgs = mergeConnectorArgs(connector, argumentName2Value); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
100 |
this.vm = isLaunch |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
101 |
? launchTarget() |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
102 |
: listenTarget(port, remoteVMOptions); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
103 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
104 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
105 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
106 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
107 |
* Returns the resulting {@code VirtualMachine} instance. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
108 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
109 |
* @return the virtual machine |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
110 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
111 |
public VirtualMachine vm() { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
112 |
return vm; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
113 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
114 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
115 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
116 |
* Returns the launched process. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
117 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
118 |
* @return the remote agent process |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
119 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
120 |
public Process process() { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
121 |
return process; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
122 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
123 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
124 |
/* launch child target vm */ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
125 |
private VirtualMachine launchTarget() { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
126 |
LaunchingConnector launcher = (LaunchingConnector) connector; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
127 |
try { |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
128 |
VirtualMachine new_vm = timedVirtualMachineCreation(() -> launcher.launch(connectorArgs), null); |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
129 |
process = new_vm.process(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
130 |
return new_vm; |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
131 |
} catch (Throwable ex) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
132 |
throw reportLaunchFail(ex, "launch"); |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
133 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
134 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
135 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
136 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
137 |
* Directly launch the remote agent and connect JDI to it with a |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
138 |
* ListeningConnector. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
139 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
140 |
private VirtualMachine listenTarget(int port, List<String> remoteVMOptions) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
141 |
ListeningConnector listener = (ListeningConnector) connector; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
142 |
try { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
143 |
// Start listening, get the JDI connection address |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
144 |
String addr = listener.startListening(connectorArgs); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
145 |
debug("Listening at address: " + addr); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
146 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
147 |
// Launch the RemoteAgent requesting a connection on that address |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
148 |
String javaHome = System.getProperty("java.home"); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
149 |
List<String> args = new ArrayList<>(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
150 |
args.add(javaHome == null |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
151 |
? "java" |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
152 |
: javaHome + File.separator + "bin" + File.separator + "java"); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
153 |
args.add("-agentlib:jdwp=transport=" + connector.transport().name() + |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
154 |
",address=" + addr); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
155 |
args.addAll(remoteVMOptions); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
156 |
args.add(remoteAgent); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
157 |
args.add("" + port); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
158 |
ProcessBuilder pb = new ProcessBuilder(args); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
159 |
process = pb.start(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
160 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
161 |
// Accept the connection from the remote agent |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
162 |
vm = timedVirtualMachineCreation(() -> listener.accept(connectorArgs), |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
163 |
() -> process.waitFor()); |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
164 |
return vm; |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
165 |
} catch (Throwable ex) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
166 |
if (process != null) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
167 |
process.destroyForcibly(); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
168 |
} |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
169 |
throw reportLaunchFail(ex, "listen"); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
170 |
} finally { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
171 |
try { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
172 |
listener.stopListening(connectorArgs); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
173 |
} catch (IOException | IllegalConnectorArgumentsException ex) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
174 |
// ignore |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
175 |
} |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
176 |
} |
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
177 |
} |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
178 |
|
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
179 |
VirtualMachine timedVirtualMachineCreation(Callable<VirtualMachine> creator, |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
180 |
Callable<Integer> processComplete) throws Exception { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
181 |
VirtualMachine result; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
182 |
ExecutorService executor = Executors.newCachedThreadPool(runnable -> { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
183 |
Thread thread = Executors.defaultThreadFactory().newThread(runnable); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
184 |
thread.setDaemon(true); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
185 |
return thread; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
186 |
}); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
187 |
try { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
188 |
Future<VirtualMachine> future = executor.submit(creator); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
189 |
if (processComplete != null) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
190 |
executor.submit(() -> { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
191 |
Integer i = processComplete.call(); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
192 |
future.cancel(true); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
193 |
return i; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
194 |
}); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
195 |
} |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
196 |
|
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
197 |
try { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
198 |
result = future.get(connectTimeout, TimeUnit.MILLISECONDS); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
199 |
} catch (TimeoutException ex) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
200 |
future.cancel(true); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
201 |
throw ex; |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
202 |
} |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
203 |
} finally { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
204 |
executor.shutdownNow(); |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
205 |
} |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
206 |
return result; |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
207 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
208 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
209 |
private Connector findConnector(String name) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
210 |
for (Connector cntor |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
211 |
: Bootstrap.virtualMachineManager().allConnectors()) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
212 |
if (cntor.name().equals(name)) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
213 |
return cntor; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
214 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
215 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
216 |
return null; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
217 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
218 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
219 |
private Map<String, Connector.Argument> mergeConnectorArgs(Connector connector, Map<String, String> argumentName2Value) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
220 |
Map<String, Connector.Argument> arguments = connector.defaultArguments(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
221 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
222 |
for (Entry<String, String> argumentEntry : argumentName2Value.entrySet()) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
223 |
String name = argumentEntry.getKey(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
224 |
String value = argumentEntry.getValue(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
225 |
Connector.Argument argument = arguments.get(name); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
226 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
227 |
if (argument == null) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
228 |
throw new IllegalArgumentException("Argument is not defined for connector:" + |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
229 |
name + " -- " + connector.name()); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
230 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
231 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
232 |
argument.setValue(value); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
233 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
234 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
235 |
return arguments; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
236 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
237 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
238 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
239 |
* The JShell specific Connector args for the LaunchingConnector. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
240 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
241 |
* @param portthe socket port for (non-JDI) commands |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
242 |
* @param remoteVMOptions any user requested VM options |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
243 |
* @return the argument map |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
244 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
245 |
private Map<String, String> launchArgs(int port, String remoteVMOptions) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
246 |
Map<String, String> argumentName2Value = new HashMap<>(); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
247 |
argumentName2Value.put("main", remoteAgent + " " + port); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
248 |
argumentName2Value.put("options", remoteVMOptions); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
249 |
return argumentName2Value; |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
250 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
251 |
|
42272
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
252 |
private InternalError reportLaunchFail(Throwable ex, String context) { |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
253 |
return new InternalError("Failed remote " + context + ": " |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
254 |
+ ex.toString() |
82e273c4f2b3
8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents:
41941
diff
changeset
|
255 |
+ " @ " + connector + |
39807
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
256 |
" -- " + connectorArgs, ex); |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
257 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
258 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
259 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
260 |
* Log debugging information. Arguments as for {@code printf}. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
261 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
262 |
* @param format a format string as described in Format string syntax |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
263 |
* @param args arguments referenced by the format specifiers in the format |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
264 |
* string. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
265 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
266 |
private void debug(String format, Object... args) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
267 |
// Reserved for future logging |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
268 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
269 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
270 |
/** |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
271 |
* Log a serious unexpected internal exception. |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
272 |
* |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
273 |
* @param ex the exception |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
274 |
* @param where a description of the context of the exception |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
275 |
*/ |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
276 |
private void debug(Throwable ex, String where) { |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
277 |
// Reserved for future logging |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
278 |
} |
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
279 |
|
ba0ff343d241
8160127: JShell API: extract abstract JDI and abstract streaming implementations of ExecutionControl
rfield
parents:
diff
changeset
|
280 |
} |