Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
42e48ae0
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42e48ae0
编写于
11月 06, 2016
作者:
R
rfield
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8161983: JShell API: Clean-up following 8160127 et. al.
Reviewed-by: jlahoda
上级
286708d0
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
43 addition
and
43 deletion
+43
-43
langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
...tools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
+4
-5
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java
...sses/jdk/jshell/execution/JdiDefaultExecutionControl.java
+5
-5
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiEventHandler.java
...l/share/classes/jdk/jshell/execution/JdiEventHandler.java
+2
-2
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java
...are/classes/jdk/jshell/execution/JdiExecutionControl.java
+2
-2
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
...hell/share/classes/jdk/jshell/execution/JdiInitiator.java
+2
-2
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
.../classes/jdk/jshell/execution/RemoteExecutionControl.java
+1
-1
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
...c/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
+2
-2
langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java
...jshell/share/classes/jdk/jshell/spi/ExecutionControl.java
+2
-1
langtools/test/jdk/jshell/FailOverExecutionControlTest.java
langtools/test/jdk/jshell/FailOverExecutionControlTest.java
+2
-2
langtools/test/jdk/jshell/JdiLaunchingExecutionControlTest.java
...ols/test/jdk/jshell/JdiLaunchingExecutionControlTest.java
+4
-4
langtools/test/jdk/jshell/JdiListeningExecutionControlTest.java
...ols/test/jdk/jshell/JdiListeningExecutionControlTest.java
+4
-4
langtools/test/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java
...jdk/jshell/JdiListeningLocalhostExecutionControlTest.java
+4
-4
langtools/test/jdk/jshell/UserJdiUserRemoteTest.java
langtools/test/jdk/jshell/UserJdiUserRemoteTest.java
+9
-9
未找到文件。
langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
浏览文件 @
42e48ae0
...
...
@@ -47,7 +47,7 @@ import java.util.function.Supplier;
import
java.util.stream.Stream
;
import
jdk.internal.jshell.debug.InternalDebugControl
;
import
jdk.jshell.Snippet.Status
;
import
jdk.jshell.execution.J
DI
DefaultExecutionControl
;
import
jdk.jshell.execution.J
di
DefaultExecutionControl
;
import
jdk.jshell.spi.ExecutionControl.EngineTerminationException
;
import
jdk.jshell.spi.ExecutionControl.ExecutionControlException
;
import
jdk.jshell.spi.ExecutionEnv
;
...
...
@@ -117,10 +117,9 @@ public class JShell implements AutoCloseable {
this
.
extraRemoteVMOptions
=
b
.
extraRemoteVMOptions
;
this
.
extraCompilerOptions
=
b
.
extraCompilerOptions
;
this
.
executionControlGenerator
=
b
.
executionControlGenerator
==
null
?
failOverExecutionControlGenerator
(
JDIDefaultExecutionControl
.
launch
(),
JDIDefaultExecutionControl
.
listen
(
"localhost"
),
JDIDefaultExecutionControl
.
listen
(
null
))
?
failOverExecutionControlGenerator
(
JdiDefaultExecutionControl
.
launch
(),
JdiDefaultExecutionControl
.
listen
(
"localhost"
),
JdiDefaultExecutionControl
.
listen
(
null
))
:
b
.
executionControlGenerator
;
this
.
maps
=
new
SnippetMaps
(
this
);
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
DI
DefaultExecutionControl.java
→
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
di
DefaultExecutionControl.java
浏览文件 @
42e48ae0
...
...
@@ -60,7 +60,7 @@ import static jdk.jshell.execution.Util.remoteInputOutput;
* @author Robert Field
* @author Jan Lahoda
*/
public
class
J
DIDefaultExecutionControl
extends
JDI
ExecutionControl
{
public
class
J
diDefaultExecutionControl
extends
Jdi
ExecutionControl
{
private
static
final
String
REMOTE_AGENT
=
RemoteExecutionControl
.
class
.
getName
();
...
...
@@ -117,14 +117,14 @@ public class JDIDefaultExecutionControl extends JDIExecutionControl {
int
port
=
listener
.
getLocalPort
();
// Set-up the JDI connection
J
DIInitiator
jdii
=
new
JDI
Initiator
(
port
,
J
diInitiator
jdii
=
new
Jdi
Initiator
(
port
,
env
.
extraRemoteVMOptions
(),
REMOTE_AGENT
,
isLaunch
,
host
);
VirtualMachine
vm
=
jdii
.
vm
();
Process
process
=
jdii
.
process
();
List
<
Consumer
<
String
>>
deathListeners
=
new
ArrayList
<>();
deathListeners
.
add
(
s
->
env
.
closeDown
());
Util
.
detectJ
DI
ExitEvent
(
vm
,
s
->
{
Util
.
detectJ
di
ExitEvent
(
vm
,
s
->
{
for
(
Consumer
<
String
>
h
:
deathListeners
)
{
h
.
accept
(
s
);
}
...
...
@@ -140,7 +140,7 @@ public class JDIDefaultExecutionControl extends JDIExecutionControl {
outputs
.
put
(
"err"
,
env
.
userErr
());
Map
<
String
,
InputStream
>
input
=
new
HashMap
<>();
input
.
put
(
"in"
,
env
.
userIn
());
return
remoteInputOutput
(
socket
.
getInputStream
(),
out
,
outputs
,
input
,
(
objIn
,
objOut
)
->
new
J
DI
DefaultExecutionControl
(
objOut
,
objIn
,
vm
,
process
,
deathListeners
));
return
remoteInputOutput
(
socket
.
getInputStream
(),
out
,
outputs
,
input
,
(
objIn
,
objOut
)
->
new
J
di
DefaultExecutionControl
(
objOut
,
objIn
,
vm
,
process
,
deathListeners
));
}
}
...
...
@@ -150,7 +150,7 @@ public class JDIDefaultExecutionControl extends JDIExecutionControl {
* @param cmdout the output for commands
* @param cmdin the input for responses
*/
private
J
DI
DefaultExecutionControl
(
ObjectOutput
cmdout
,
ObjectInput
cmdin
,
private
J
di
DefaultExecutionControl
(
ObjectOutput
cmdout
,
ObjectInput
cmdin
,
VirtualMachine
vm
,
Process
process
,
List
<
Consumer
<
String
>>
deathListeners
)
{
super
(
cmdout
,
cmdin
);
this
.
vm
=
vm
;
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
DI
EventHandler.java
→
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
di
EventHandler.java
浏览文件 @
42e48ae0
...
...
@@ -34,7 +34,7 @@ import com.sun.jdi.event.*;
* Adapted from jdb EventHandler.
* Only exit and disconnect events processed.
*/
class
J
DI
EventHandler
implements
Runnable
{
class
J
di
EventHandler
implements
Runnable
{
private
final
Thread
thread
;
private
volatile
boolean
connected
=
true
;
...
...
@@ -49,7 +49,7 @@ class JDIEventHandler implements Runnable {
* @param reportVMExit callback to report exit/disconnect
* (passed true if the VM has died)
*/
J
DI
EventHandler
(
VirtualMachine
vm
,
Consumer
<
String
>
reportVMExit
)
{
J
di
EventHandler
(
VirtualMachine
vm
,
Consumer
<
String
>
reportVMExit
)
{
this
.
vm
=
vm
;
this
.
reportVMExit
=
reportVMExit
;
this
.
thread
=
new
Thread
(
this
,
"event-handler"
);
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
DI
ExecutionControl.java
→
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
di
ExecutionControl.java
浏览文件 @
42e48ae0
...
...
@@ -39,7 +39,7 @@ import static java.util.stream.Collectors.toMap;
/**
* Abstract JDI implementation of {@link jdk.jshell.spi.ExecutionControl}
*/
public
abstract
class
J
DI
ExecutionControl
extends
StreamingExecutionControl
implements
ExecutionControl
{
public
abstract
class
J
di
ExecutionControl
extends
StreamingExecutionControl
implements
ExecutionControl
{
/**
* Mapping from class names to JDI {@link ReferenceType}.
...
...
@@ -51,7 +51,7 @@ public abstract class JDIExecutionControl extends StreamingExecutionControl impl
* @param out the output from the remote agent
* @param in the input to the remote agent
*/
protected
J
DI
ExecutionControl
(
ObjectOutput
out
,
ObjectInput
in
)
{
protected
J
di
ExecutionControl
(
ObjectOutput
out
,
ObjectInput
in
)
{
super
(
out
,
in
);
}
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
DI
Initiator.java
→
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/J
di
Initiator.java
浏览文件 @
42e48ae0
...
...
@@ -40,7 +40,7 @@ import com.sun.jdi.connect.ListeningConnector;
* Sets up a JDI connection, providing the resulting JDI {@link VirtualMachine}
* and the {@link Process} the remote agent is running in.
*/
public
class
J
DI
Initiator
{
public
class
J
di
Initiator
{
private
VirtualMachine
vm
;
private
Process
process
=
null
;
...
...
@@ -59,7 +59,7 @@ public class JDIInitiator {
* @param host explicit hostname to use, if null use discovered
* hostname, applies to listening only (!isLaunch)
*/
public
J
DI
Initiator
(
int
port
,
List
<
String
>
remoteVMOptions
,
String
remoteAgent
,
public
J
di
Initiator
(
int
port
,
List
<
String
>
remoteVMOptions
,
String
remoteAgent
,
boolean
isLaunch
,
String
host
)
{
this
.
remoteAgent
=
remoteAgent
;
String
connectorName
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
浏览文件 @
42e48ae0
...
...
@@ -41,7 +41,7 @@ import static jdk.jshell.execution.Util.forwardExecutionControlAndIO;
* process). This agent loads code over a socket from the main JShell process,
* executes the code, and other misc, Specialization of
* {@link DirectExecutionControl} which adds stop support controlled by
* an external process. Designed to work with {@link J
DI
DefaultExecutionControl}.
* an external process. Designed to work with {@link J
di
DefaultExecutionControl}.
*
* @author Jan Lahoda
* @author Robert Field
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
浏览文件 @
42e48ae0
...
...
@@ -239,9 +239,9 @@ public class Util {
* @param unbiddenExitHandler the handler, which will accept the exit
* information
*/
public
static
void
detectJ
DI
ExitEvent
(
VirtualMachine
vm
,
Consumer
<
String
>
unbiddenExitHandler
)
{
public
static
void
detectJ
di
ExitEvent
(
VirtualMachine
vm
,
Consumer
<
String
>
unbiddenExitHandler
)
{
if
(
vm
.
canBeModified
())
{
new
J
DI
EventHandler
(
vm
,
unbiddenExitHandler
).
start
();
new
J
di
EventHandler
(
vm
,
unbiddenExitHandler
).
start
();
}
}
...
...
langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java
浏览文件 @
42e48ae0
...
...
@@ -44,12 +44,13 @@ import java.io.Serializable;
* To install an {@code ExecutionControl}, its {@code Generator} is passed to
* {@link jdk.jshell.JShell.Builder#executionEngine(ExecutionControl.Generator) }.
*/
public
interface
ExecutionControl
{
public
interface
ExecutionControl
extends
AutoCloseable
{
/**
* Defines a functional interface for creating {@link ExecutionControl}
* instances.
*/
@FunctionalInterface
public
interface
Generator
{
/**
...
...
langtools/test/jdk/jshell/FailOverExecutionControlTest.java
浏览文件 @
42e48ae0
...
...
@@ -33,7 +33,7 @@
import
org.testng.annotations.Test
;
import
org.testng.annotations.BeforeMethod
;
import
jdk.jshell.execution.J
DI
DefaultExecutionControl
;
import
jdk.jshell.execution.J
di
DefaultExecutionControl
;
import
jdk.jshell.spi.ExecutionControl
;
import
jdk.jshell.spi.ExecutionEnv
;
import
static
jdk
.
jshell
.
execution
.
Util
.
failOverExecutionControlGenerator
;
...
...
@@ -47,7 +47,7 @@ public class FailOverExecutionControlTest extends ExecutionControlTestBase {
setUp
(
builder
->
builder
.
executionEngine
(
failOverExecutionControlGenerator
(
new
AlwaysFailingGenerator
(),
new
AlwaysFailingGenerator
(),
J
DI
DefaultExecutionControl
.
launch
())));
J
di
DefaultExecutionControl
.
launch
())));
}
class
AlwaysFailingGenerator
implements
ExecutionControl
.
Generator
{
...
...
langtools/test/jdk/jshell/J
DI
LaunchingExecutionControlTest.java
→
langtools/test/jdk/jshell/J
di
LaunchingExecutionControlTest.java
浏览文件 @
42e48ae0
...
...
@@ -27,20 +27,20 @@
* @summary Tests for standard JDI connector (without failover) -- launching
* @modules jdk.jshell/jdk.jshell.execution
* @build KullaTesting ExecutionControlTestBase
* @run testng J
DI
LaunchingExecutionControlTest
* @run testng J
di
LaunchingExecutionControlTest
*/
import
org.testng.annotations.Test
;
import
org.testng.annotations.BeforeMethod
;
import
jdk.jshell.execution.J
DI
DefaultExecutionControl
;
import
jdk.jshell.execution.J
di
DefaultExecutionControl
;
@Test
public
class
J
DI
LaunchingExecutionControlTest
extends
ExecutionControlTestBase
{
public
class
J
di
LaunchingExecutionControlTest
extends
ExecutionControlTestBase
{
@BeforeMethod
@Override
public
void
setUp
()
{
setUp
(
builder
->
builder
.
executionEngine
(
J
DI
DefaultExecutionControl
.
launch
()));
setUp
(
builder
->
builder
.
executionEngine
(
J
di
DefaultExecutionControl
.
launch
()));
}
}
langtools/test/jdk/jshell/J
DI
ListeningExecutionControlTest.java
→
langtools/test/jdk/jshell/J
di
ListeningExecutionControlTest.java
浏览文件 @
42e48ae0
...
...
@@ -27,20 +27,20 @@
* @summary Tests for alternate JDI connector -- listening
* @modules jdk.jshell/jdk.jshell.execution
* @build KullaTesting ExecutionControlTestBase
* @run testng J
DI
ListeningExecutionControlTest
* @run testng J
di
ListeningExecutionControlTest
*/
import
org.testng.annotations.Test
;
import
org.testng.annotations.BeforeMethod
;
import
jdk.jshell.execution.J
DI
DefaultExecutionControl
;
import
jdk.jshell.execution.J
di
DefaultExecutionControl
;
@Test
public
class
J
DI
ListeningExecutionControlTest
extends
ExecutionControlTestBase
{
public
class
J
di
ListeningExecutionControlTest
extends
ExecutionControlTestBase
{
@BeforeMethod
@Override
public
void
setUp
()
{
setUp
(
builder
->
builder
.
executionEngine
(
J
DI
DefaultExecutionControl
.
listen
(
null
)));
setUp
(
builder
->
builder
.
executionEngine
(
J
di
DefaultExecutionControl
.
listen
(
null
)));
}
}
langtools/test/jdk/jshell/J
DI
ListeningLocalhostExecutionControlTest.java
→
langtools/test/jdk/jshell/J
di
ListeningLocalhostExecutionControlTest.java
浏览文件 @
42e48ae0
...
...
@@ -27,20 +27,20 @@
* @summary Tests for alternate JDI connector -- listening to "localhost"
* @modules jdk.jshell/jdk.jshell.execution
* @build KullaTesting ExecutionControlTestBase
* @run testng J
DI
ListeningLocalhostExecutionControlTest
* @run testng J
di
ListeningLocalhostExecutionControlTest
*/
import
org.testng.annotations.Test
;
import
org.testng.annotations.BeforeMethod
;
import
jdk.jshell.execution.J
DI
DefaultExecutionControl
;
import
jdk.jshell.execution.J
di
DefaultExecutionControl
;
@Test
public
class
J
DI
ListeningLocalhostExecutionControlTest
extends
ExecutionControlTestBase
{
public
class
J
di
ListeningLocalhostExecutionControlTest
extends
ExecutionControlTestBase
{
@BeforeMethod
@Override
public
void
setUp
()
{
setUp
(
builder
->
builder
.
executionEngine
(
J
DI
DefaultExecutionControl
.
listen
(
"localhost"
)));
setUp
(
builder
->
builder
.
executionEngine
(
J
di
DefaultExecutionControl
.
listen
(
"localhost"
)));
}
}
langtools/test/jdk/jshell/UserJ
DI
UserRemoteTest.java
→
langtools/test/jdk/jshell/UserJ
di
UserRemoteTest.java
浏览文件 @
42e48ae0
...
...
@@ -26,7 +26,7 @@
* @bug 8160128 8159935
* @summary Tests for Aux channel, custom remote agents, custom JDI implementations.
* @build KullaTesting ExecutionControlTestBase
* @run testng UserJ
DI
UserRemoteTest
* @run testng UserJ
di
UserRemoteTest
*/
import
java.io.ByteArrayOutputStream
;
import
org.testng.annotations.Test
;
...
...
@@ -44,8 +44,8 @@ import com.sun.jdi.VMDisconnectedException;
import
com.sun.jdi.VirtualMachine
;
import
jdk.jshell.VarSnippet
;
import
jdk.jshell.execution.DirectExecutionControl
;
import
jdk.jshell.execution.J
DI
ExecutionControl
;
import
jdk.jshell.execution.J
DI
Initiator
;
import
jdk.jshell.execution.J
di
ExecutionControl
;
import
jdk.jshell.execution.J
di
Initiator
;
import
jdk.jshell.execution.Util
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
...
...
@@ -64,7 +64,7 @@ import static jdk.jshell.execution.Util.forwardExecutionControlAndIO;
import
static
jdk
.
jshell
.
execution
.
Util
.
remoteInputOutput
;
@Test
public
class
UserJ
DI
UserRemoteTest
extends
ExecutionControlTestBase
{
public
class
UserJ
di
UserRemoteTest
extends
ExecutionControlTestBase
{
ExecutionControl
currentEC
;
ByteArrayOutputStream
auxStream
;
...
...
@@ -115,7 +115,7 @@ public class UserJDIUserRemoteTest extends ExecutionControlTestBase {
}
}
class
MyExecutionControl
extends
J
DI
ExecutionControl
{
class
MyExecutionControl
extends
J
di
ExecutionControl
{
private
static
final
String
REMOTE_AGENT
=
MyRemoteExecutionControl
.
class
.
getName
();
...
...
@@ -128,7 +128,7 @@ class MyExecutionControl extends JDIExecutionControl {
*
* @return the generator
*/
public
static
ExecutionControl
.
Generator
create
(
UserJ
DI
UserRemoteTest
test
)
{
public
static
ExecutionControl
.
Generator
create
(
UserJ
di
UserRemoteTest
test
)
{
return
env
->
make
(
env
,
test
);
}
...
...
@@ -145,7 +145,7 @@ class MyExecutionControl extends JDIExecutionControl {
* @return the channel
* @throws IOException if there are errors in set-up
*/
static
ExecutionControl
make
(
ExecutionEnv
env
,
UserJ
DI
UserRemoteTest
test
)
throws
IOException
{
static
ExecutionControl
make
(
ExecutionEnv
env
,
UserJ
di
UserRemoteTest
test
)
throws
IOException
{
try
(
final
ServerSocket
listener
=
new
ServerSocket
(
0
))
{
// timeout after 60 seconds
listener
.
setSoTimeout
(
60000
);
...
...
@@ -157,14 +157,14 @@ class MyExecutionControl extends JDIExecutionControl {
opts
.
add
(
System
.
getProperty
(
"java.class.path"
)
+
System
.
getProperty
(
"path.separator"
)
+
System
.
getProperty
(
"user.dir"
));
J
DIInitiator
jdii
=
new
JDI
Initiator
(
port
,
J
diInitiator
jdii
=
new
Jdi
Initiator
(
port
,
opts
,
REMOTE_AGENT
,
true
,
null
);
VirtualMachine
vm
=
jdii
.
vm
();
Process
process
=
jdii
.
process
();
List
<
Consumer
<
String
>>
deathListeners
=
new
ArrayList
<>();
deathListeners
.
add
(
s
->
env
.
closeDown
());
Util
.
detectJ
DI
ExitEvent
(
vm
,
s
->
{
Util
.
detectJ
di
ExitEvent
(
vm
,
s
->
{
for
(
Consumer
<
String
>
h
:
deathListeners
)
{
h
.
accept
(
s
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录