Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
07cf865d
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看板
提交
07cf865d
编写于
9月 13, 2012
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7197637: (ch) sun.nio.ch.Default* cause providers for other platforms to be included in rt.jar
Reviewed-by: mchung
上级
16402350
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
49 deletion
+54
-49
src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
...lasses/sun/nio/ch/DefaultAsynchronousChannelProvider.java
+19
-4
src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
+22
-25
src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
...solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
+13
-20
未找到文件。
src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
浏览文件 @
07cf865d
...
...
@@ -40,6 +40,22 @@ public class DefaultAsynchronousChannelProvider {
*/
private
DefaultAsynchronousChannelProvider
()
{
}
@SuppressWarnings
(
"unchecked"
)
private
static
AsynchronousChannelProvider
createProvider
(
String
cn
)
{
Class
<
AsynchronousChannelProvider
>
c
;
try
{
c
=
(
Class
<
AsynchronousChannelProvider
>)
Class
.
forName
(
cn
);
}
catch
(
ClassNotFoundException
x
)
{
throw
new
AssertionError
(
x
);
}
try
{
return
c
.
newInstance
();
}
catch
(
IllegalAccessException
|
InstantiationException
x
)
{
throw
new
AssertionError
(
x
);
}
}
/**
* Returns the default AsynchronousChannelProvider.
*/
...
...
@@ -47,12 +63,11 @@ public class DefaultAsynchronousChannelProvider {
String
osname
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.name"
));
if
(
osname
.
equals
(
"SunOS"
))
return
new
SolarisAsynchronousChannelProvider
(
);
return
createProvider
(
"sun.nio.ch.SolarisAsynchronousChannelProvider"
);
if
(
osname
.
equals
(
"Linux"
))
return
new
LinuxAsynchronousChannelProvider
(
);
return
createProvider
(
"sun.nio.ch.LinuxAsynchronousChannelProvider"
);
if
(
osname
.
contains
(
"OS X"
))
return
new
BsdAsynchronousChannelProvider
(
);
return
createProvider
(
"sun.nio.ch.BsdAsynchronousChannelProvider"
);
throw
new
InternalError
(
"platform not recognized"
);
}
}
src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
浏览文件 @
07cf865d
...
...
@@ -27,7 +27,6 @@ package sun.nio.ch;
import
java.nio.channels.spi.SelectorProvider
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
sun.security.action.GetPropertyAction
;
/**
...
...
@@ -41,34 +40,32 @@ public class DefaultSelectorProvider {
*/
private
DefaultSelectorProvider
()
{
}
@SuppressWarnings
(
"unchecked"
)
private
static
SelectorProvider
createProvider
(
String
cn
)
{
Class
<
SelectorProvider
>
c
;
try
{
c
=
(
Class
<
SelectorProvider
>)
Class
.
forName
(
cn
);
}
catch
(
ClassNotFoundException
x
)
{
throw
new
AssertionError
(
x
);
}
try
{
return
c
.
newInstance
();
}
catch
(
IllegalAccessException
|
InstantiationException
x
)
{
throw
new
AssertionError
(
x
);
}
}
/**
* Returns the default SelectorProvider.
*/
public
static
SelectorProvider
create
()
{
String
osname
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.name"
));
if
(
"SunOS"
.
equals
(
osname
))
{
return
new
sun
.
nio
.
ch
.
DevPollSelectorProvider
();
}
// use EPollSelectorProvider for Linux kernels >= 2.6
if
(
"Linux"
.
equals
(
osname
))
{
String
osversion
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.version"
));
String
[]
vers
=
osversion
.
split
(
"\\."
,
0
);
if
(
vers
.
length
>=
2
)
{
try
{
int
major
=
Integer
.
parseInt
(
vers
[
0
]);
int
minor
=
Integer
.
parseInt
(
vers
[
1
]);
if
(
major
>
2
||
(
major
==
2
&&
minor
>=
6
))
{
return
new
sun
.
nio
.
ch
.
EPollSelectorProvider
();
}
}
catch
(
NumberFormatException
x
)
{
// format not recognized
}
}
}
String
osname
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.name"
));
if
(
osname
.
equals
(
"SunOS"
))
return
createProvider
(
"sun.nio.ch.DevPollSelectorProvider"
);
if
(
osname
.
equals
(
"Linux"
))
return
createProvider
(
"sun.nio.ch.EPollSelectorProvider"
);
return
new
sun
.
nio
.
ch
.
PollSelectorProvider
();
}
...
...
src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
浏览文件 @
07cf865d
...
...
@@ -27,7 +27,6 @@ package sun.nio.fs;
import
java.nio.file.spi.FileSystemProvider
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
sun.security.action.GetPropertyAction
;
/**
...
...
@@ -38,24 +37,18 @@ public class DefaultFileSystemProvider {
private
DefaultFileSystemProvider
()
{
}
@SuppressWarnings
(
"unchecked"
)
private
static
FileSystemProvider
createProvider
(
final
String
cn
)
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
FileSystemProvider
>()
{
public
FileSystemProvider
run
()
{
Class
<
FileSystemProvider
>
c
;
try
{
c
=
(
Class
<
FileSystemProvider
>)
Class
.
forName
(
cn
,
true
,
null
);
}
catch
(
ClassNotFoundException
x
)
{
throw
new
AssertionError
(
x
);
}
try
{
return
c
.
newInstance
();
}
catch
(
IllegalAccessException
x
)
{
throw
new
AssertionError
(
x
);
}
catch
(
InstantiationException
x
)
{
throw
new
AssertionError
(
x
);
}
}});
private
static
FileSystemProvider
createProvider
(
String
cn
)
{
Class
<
FileSystemProvider
>
c
;
try
{
c
=
(
Class
<
FileSystemProvider
>)
Class
.
forName
(
cn
);
}
catch
(
ClassNotFoundException
x
)
{
throw
new
AssertionError
(
x
);
}
try
{
return
c
.
newInstance
();
}
catch
(
IllegalAccessException
|
InstantiationException
x
)
{
throw
new
AssertionError
(
x
);
}
}
/**
...
...
@@ -68,7 +61,7 @@ public class DefaultFileSystemProvider {
return
createProvider
(
"sun.nio.fs.SolarisFileSystemProvider"
);
if
(
osname
.
equals
(
"Linux"
))
return
createProvider
(
"sun.nio.fs.LinuxFileSystemProvider"
);
if
(
osname
.
equals
(
"Darwin"
)
||
osname
.
contains
(
"OS X"
))
if
(
osname
.
contains
(
"OS X"
))
return
createProvider
(
"sun.nio.fs.MacOSXFileSystemProvider"
);
throw
new
AssertionError
(
"Platform not recognized"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录