Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7f8d92e4
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7f8d92e4
编写于
10月 15, 2014
作者:
S
smarks
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8055309: RMI needs better transportation considerations
Reviewed-by: alanb, igerasim, skoivu, msheppar
上级
386063a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
52 addition
and
16 deletion
+52
-16
src/share/classes/sun/rmi/transport/Transport.java
src/share/classes/sun/rmi/transport/Transport.java
+27
-5
src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
+25
-11
未找到文件。
src/share/classes/sun/rmi/transport/Transport.java
浏览文件 @
7f8d92e4
/*
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -37,6 +37,10 @@ import java.rmi.server.RemoteCall;
...
@@ -37,6 +37,10 @@ import java.rmi.server.RemoteCall;
import
java.rmi.server.RemoteServer
;
import
java.rmi.server.RemoteServer
;
import
java.rmi.server.ServerNotActiveException
;
import
java.rmi.server.ServerNotActiveException
;
import
java.security.AccessControlContext
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.Permissions
;
import
java.security.PrivilegedAction
;
import
java.security.ProtectionDomain
;
import
sun.rmi.runtime.Log
;
import
sun.rmi.runtime.Log
;
import
sun.rmi.server.Dispatcher
;
import
sun.rmi.server.Dispatcher
;
import
sun.rmi.server.UnicastServerRef
;
import
sun.rmi.server.UnicastServerRef
;
...
@@ -68,6 +72,15 @@ public abstract class Transport {
...
@@ -68,6 +72,15 @@ public abstract class Transport {
/** ObjID for DGCImpl */
/** ObjID for DGCImpl */
private
static
final
ObjID
dgcID
=
new
ObjID
(
ObjID
.
DGC_ID
);
private
static
final
ObjID
dgcID
=
new
ObjID
(
ObjID
.
DGC_ID
);
/** AccessControlContext for setting context ClassLoader */
private
static
final
AccessControlContext
SETCCL_ACC
;
static
{
Permissions
perms
=
new
Permissions
();
perms
.
add
(
new
RuntimePermission
(
"setContextClassLoader"
));
ProtectionDomain
[]
pd
=
{
new
ProtectionDomain
(
null
,
perms
)
};
SETCCL_ACC
=
new
AccessControlContext
(
pd
);
}
/**
/**
* Returns a <I>Channel</I> that generates connections to the
* Returns a <I>Channel</I> that generates connections to the
* endpoint <I>ep</I>. A Channel is an object that creates and
* endpoint <I>ep</I>. A Channel is an object that creates and
...
@@ -116,6 +129,16 @@ public abstract class Transport {
...
@@ -116,6 +129,16 @@ public abstract class Transport {
*/
*/
protected
abstract
void
checkAcceptPermission
(
AccessControlContext
acc
);
protected
abstract
void
checkAcceptPermission
(
AccessControlContext
acc
);
/**
* Sets the context class loader for the current thread.
*/
private
static
void
setContextClassLoader
(
ClassLoader
ccl
)
{
AccessController
.
doPrivileged
((
PrivilegedAction
<
Void
>)()
->
{
Thread
.
currentThread
().
setContextClassLoader
(
ccl
);
return
null
;
},
SETCCL_ACC
);
}
/**
/**
* Service an incoming remote call. When a message arrives on the
* Service an incoming remote call. When a message arrives on the
* connection indicating the beginning of a remote call, the
* connection indicating the beginning of a remote call, the
...
@@ -164,11 +187,10 @@ public abstract class Transport {
...
@@ -164,11 +187,10 @@ public abstract class Transport {
target
.
getAccessControlContext
();
target
.
getAccessControlContext
();
ClassLoader
ccl
=
target
.
getContextClassLoader
();
ClassLoader
ccl
=
target
.
getContextClassLoader
();
Thread
t
=
Thread
.
currentThread
();
ClassLoader
savedCcl
=
Thread
.
currentThread
().
getContextClassLoader
();
ClassLoader
savedCcl
=
t
.
getContextClassLoader
();
try
{
try
{
t
.
setContextClassLoader
(
ccl
);
setContextClassLoader
(
ccl
);
currentTransport
.
set
(
this
);
currentTransport
.
set
(
this
);
try
{
try
{
java
.
security
.
AccessController
.
doPrivileged
(
java
.
security
.
AccessController
.
doPrivileged
(
...
@@ -183,7 +205,7 @@ public abstract class Transport {
...
@@ -183,7 +205,7 @@ public abstract class Transport {
throw
(
IOException
)
pae
.
getException
();
throw
(
IOException
)
pae
.
getException
();
}
}
}
finally
{
}
finally
{
t
.
setContextClassLoader
(
savedCcl
);
setContextClassLoader
(
savedCcl
);
currentTransport
.
set
(
null
);
currentTransport
.
set
(
null
);
}
}
...
...
src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
浏览文件 @
7f8d92e4
/*
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -49,6 +49,9 @@ import java.rmi.server.ServerNotActiveException;
...
@@ -49,6 +49,9 @@ import java.rmi.server.ServerNotActiveException;
import
java.rmi.server.UID
;
import
java.rmi.server.UID
;
import
java.security.AccessControlContext
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.Permissions
;
import
java.security.PrivilegedAction
;
import
java.security.ProtectionDomain
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -123,6 +126,14 @@ public class TCPTransport extends Transport {
...
@@ -123,6 +126,14 @@ public class TCPTransport extends Transport {
private
static
final
ThreadLocal
<
ConnectionHandler
>
private
static
final
ThreadLocal
<
ConnectionHandler
>
threadConnectionHandler
=
new
ThreadLocal
<>();
threadConnectionHandler
=
new
ThreadLocal
<>();
/** an AccessControlContext with no permissions */
private
static
final
AccessControlContext
NOPERMS_ACC
;
static
{
Permissions
perms
=
new
Permissions
();
ProtectionDomain
[]
pd
=
{
new
ProtectionDomain
(
null
,
perms
)
};
NOPERMS_ACC
=
new
AccessControlContext
(
pd
);
}
/** endpoints for this transport */
/** endpoints for this transport */
private
final
LinkedList
<
TCPEndpoint
>
epList
;
private
final
LinkedList
<
TCPEndpoint
>
epList
;
/** number of objects exported on this transport */
/** number of objects exported on this transport */
...
@@ -662,16 +673,19 @@ public class TCPTransport extends Transport {
...
@@ -662,16 +673,19 @@ public class TCPTransport extends Transport {
}
}
public
void
run
()
{
public
void
run
()
{
Thread
t
=
Thread
.
currentThread
();
AccessController
.
doPrivileged
((
PrivilegedAction
<
Void
>)()
->
{
String
name
=
t
.
getName
();
Thread
t
=
Thread
.
currentThread
();
try
{
String
name
=
t
.
getName
();
t
.
setName
(
"RMI TCP Connection("
+
try
{
connectionCount
.
incrementAndGet
()
+
t
.
setName
(
"RMI TCP Connection("
+
")-"
+
remoteHost
);
connectionCount
.
incrementAndGet
()
+
run0
();
")-"
+
remoteHost
);
}
finally
{
run0
();
t
.
setName
(
name
);
}
finally
{
}
t
.
setName
(
name
);
}
return
null
;
},
NOPERMS_ACC
);
}
}
private
void
run0
()
{
private
void
run0
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录