Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c3a3faac
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看板
提交
c3a3faac
编写于
2月 24, 2012
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7133138: Improve io performance around timezone lookups
Reviewed-by: okutsu
上级
6b77b112
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
37 deletion
+71
-37
make/tools/src/build/tools/javazic/Mappings.java
make/tools/src/build/tools/javazic/Mappings.java
+16
-1
src/share/classes/sun/util/calendar/ZoneInfo.java
src/share/classes/sun/util/calendar/ZoneInfo.java
+33
-19
src/share/classes/sun/util/calendar/ZoneInfoFile.java
src/share/classes/sun/util/calendar/ZoneInfoFile.java
+22
-17
未找到文件。
make/tools/src/build/tools/javazic/Mappings.java
浏览文件 @
c3a3faac
/*
/*
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
package
build.tools.javazic
;
package
build.tools.javazic
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -162,6 +163,20 @@ class Mappings {
...
@@ -162,6 +163,20 @@ class Mappings {
for
(
String
key
:
toBeRemoved
)
{
for
(
String
key
:
toBeRemoved
)
{
aliases
.
remove
(
key
);
aliases
.
remove
(
key
);
}
}
// Eliminate any alias-to-alias mappings. For example, if
// there are A->B and B->C, A->B is changed to A->C.
Map
<
String
,
String
>
newMap
=
new
HashMap
<
String
,
String
>();
for
(
String
key
:
aliases
.
keySet
())
{
String
realid
=
aliases
.
get
(
key
);
String
leaf
=
realid
;
while
(
aliases
.
get
(
leaf
)
!=
null
)
{
leaf
=
aliases
.
get
(
leaf
);
}
if
(!
realid
.
equals
(
leaf
))
{
newMap
.
put
(
key
,
leaf
);
}
}
aliases
.
putAll
(
newMap
);
}
}
Map
<
String
,
String
>
getAliases
()
{
Map
<
String
,
String
>
getAliases
()
{
...
...
src/share/classes/sun/util/calendar/ZoneInfo.java
浏览文件 @
c3a3faac
/*
/*
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
@@ -79,13 +79,18 @@ public class ZoneInfo extends TimeZone {
...
@@ -79,13 +79,18 @@ public class ZoneInfo extends TimeZone {
private
static
final
int
TRANSITION_NSHIFT
=
12
;
private
static
final
int
TRANSITION_NSHIFT
=
12
;
// Flag for supporting JDK backward compatible IDs, such as "EST".
// Flag for supporting JDK backward compatible IDs, such as "EST".
private
static
final
boolean
USE_OLDMAPPING
;
static
final
boolean
USE_OLDMAPPING
;
static
{
static
{
String
oldmapping
=
AccessController
.
doPrivileged
(
String
oldmapping
=
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"sun.timezone.ids.oldmapping"
,
"false"
)).
toLowerCase
(
Locale
.
ROOT
);
new
sun
.
security
.
action
.
GetPropertyAction
(
"sun.timezone.ids.oldmapping"
,
"false"
)).
toLowerCase
(
Locale
.
ROOT
);
USE_OLDMAPPING
=
(
oldmapping
.
equals
(
"yes"
)
||
oldmapping
.
equals
(
"true"
));
USE_OLDMAPPING
=
(
oldmapping
.
equals
(
"yes"
)
||
oldmapping
.
equals
(
"true"
));
}
}
// IDs having conflicting data between Olson and JDK 1.1
static
final
String
[]
conflictingIDs
=
{
"EST"
,
"MST"
,
"HST"
};
private
static
final
CalendarSystem
gcal
=
CalendarSystem
.
getGregorianCalendar
();
private
static
final
CalendarSystem
gcal
=
CalendarSystem
.
getGregorianCalendar
();
/**
/**
...
@@ -808,32 +813,41 @@ public class ZoneInfo extends TimeZone {
...
@@ -808,32 +813,41 @@ public class ZoneInfo extends TimeZone {
private
static
SoftReference
<
Map
<
String
,
String
>>
aliasTable
;
private
static
SoftReference
<
Map
<
String
,
String
>>
aliasTable
;
/**
static
Map
<
String
,
String
>
getCachedAliasTable
()
{
* Returns a Map from alias time zone IDs to their standard
* time zone IDs.
*
* @return the Map that holds the mappings from alias time zone IDs
* to their standard time zone IDs, or null if
* <code>ZoneInfoMappings</code> file is not available.
*/
public
synchronized
static
Map
<
String
,
String
>
getAliasTable
()
{
Map
<
String
,
String
>
aliases
=
null
;
Map
<
String
,
String
>
aliases
=
null
;
SoftReference
<
Map
<
String
,
String
>>
cache
=
aliasTable
;
SoftReference
<
Map
<
String
,
String
>>
cache
=
aliasTable
;
if
(
cache
!=
null
)
{
if
(
cache
!=
null
)
{
aliases
=
cache
.
get
();
aliases
=
cache
.
get
();
if
(
aliases
!=
null
)
{
return
aliases
;
}
}
aliases
=
ZoneInfoFile
.
getZoneAliases
();
if
(
aliases
!=
null
)
{
aliasTable
=
new
SoftReference
<>(
aliases
);
}
}
return
aliases
;
return
aliases
;
}
}
/**
* Returns a Map from alias time zone IDs to their standard
* time zone IDs.
*
* @return the Map that holds the mappings from alias time zone IDs
* to their standard time zone IDs, or null if
* <code>ZoneInfoMappings</code> file is not available.
*/
public
synchronized
static
Map
<
String
,
String
>
getAliasTable
()
{
Map
<
String
,
String
>
aliases
=
getCachedAliasTable
();
if
(
aliases
==
null
)
{
aliases
=
ZoneInfoFile
.
getZoneAliases
();
if
(
aliases
!=
null
)
{
if
(!
USE_OLDMAPPING
)
{
// Remove the conflicting IDs from the alias table.
for
(
String
key
:
conflictingIDs
)
{
aliases
.
remove
(
key
);
}
}
aliasTable
=
new
SoftReference
<
Map
<
String
,
String
>>(
aliases
);
}
}
return
aliases
;
}
private
void
readObject
(
ObjectInputStream
stream
)
private
void
readObject
(
ObjectInputStream
stream
)
throws
IOException
,
ClassNotFoundException
{
throws
IOException
,
ClassNotFoundException
{
stream
.
defaultReadObject
();
stream
.
defaultReadObject
();
...
...
src/share/classes/sun/util/calendar/ZoneInfoFile.java
浏览文件 @
c3a3faac
/*
/*
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
@@ -473,6 +473,8 @@ public class ZoneInfoFile {
...
@@ -473,6 +473,8 @@ public class ZoneInfoFile {
private
static
Map
<
String
,
ZoneInfo
>
zoneInfoObjects
=
null
;
private
static
Map
<
String
,
ZoneInfo
>
zoneInfoObjects
=
null
;
private
static
final
ZoneInfo
GMT
=
new
ZoneInfo
(
"GMT"
,
0
);
private
static
final
String
ziDir
=
AccessController
.
doPrivileged
(
private
static
final
String
ziDir
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
new
PrivilegedAction
<
String
>()
{
public
String
run
()
{
public
String
run
()
{
...
@@ -553,8 +555,15 @@ public class ZoneInfoFile {
...
@@ -553,8 +555,15 @@ public class ZoneInfoFile {
* id.
* id.
*/
*/
public
static
ZoneInfo
getZoneInfo
(
String
id
)
{
public
static
ZoneInfo
getZoneInfo
(
String
id
)
{
//treat GMT zone as special
if
(
"GMT"
.
equals
(
id
))
return
(
ZoneInfo
)
GMT
.
clone
();
ZoneInfo
zi
=
getFromCache
(
id
);
ZoneInfo
zi
=
getFromCache
(
id
);
if
(
zi
==
null
)
{
if
(
zi
==
null
)
{
Map
<
String
,
String
>
aliases
=
ZoneInfo
.
getCachedAliasTable
();
if
(
aliases
!=
null
&&
aliases
.
get
(
id
)
!=
null
)
{
return
null
;
}
zi
=
createZoneInfo
(
id
);
zi
=
createZoneInfo
(
id
);
if
(
zi
==
null
)
{
if
(
zi
==
null
)
{
return
null
;
return
null
;
...
@@ -1031,30 +1040,26 @@ public class ZoneInfoFile {
...
@@ -1031,30 +1040,26 @@ public class ZoneInfoFile {
* @return the buffer, or null if any I/O error occurred.
* @return the buffer, or null if any I/O error occurred.
*/
*/
private
static
byte
[]
readZoneInfoFile
(
final
String
fileName
)
{
private
static
byte
[]
readZoneInfoFile
(
final
String
fileName
)
{
if
(
fileName
.
indexOf
(
".."
)
>=
0
)
{
return
null
;
}
byte
[]
buffer
=
null
;
byte
[]
buffer
=
null
;
try
{
try
{
buffer
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
byte
[]>()
{
buffer
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
byte
[]>()
{
public
byte
[]
run
()
throws
IOException
{
public
byte
[]
run
()
throws
IOException
{
File
file
=
new
File
(
ziDir
,
fileName
);
File
file
=
new
File
(
ziDir
,
fileName
);
if
(!
file
.
exists
()
||
!
file
.
isFile
())
{
return
null
;
}
file
=
file
.
getCanonicalFile
();
String
path
=
file
.
getCanonicalPath
();
byte
[]
buf
=
null
;
byte
[]
buf
=
null
;
if
(
path
!=
null
&&
path
.
startsWith
(
ziDir
))
{
int
filesize
=
(
int
)
file
.
length
();
int
filesize
=
(
int
)
file
.
length
();
if
(
filesize
>
0
)
{
if
(
filesize
>
0
)
{
FileInputStream
fis
=
new
FileInputStream
(
file
);
FileInputStream
fis
=
new
FileInputStream
(
file
);
buf
=
new
byte
[
filesize
];
buf
=
new
byte
[
filesize
];
try
{
try
{
if
(
fis
.
read
(
buf
)
!=
filesize
)
{
if
(
fis
.
read
(
buf
)
!=
filesize
)
{
throw
new
IOException
(
"read error on "
+
fileName
);
throw
new
IOException
(
"read error on "
+
fileName
);
}
}
finally
{
fis
.
close
();
}
}
}
finally
{
fis
.
close
();
}
}
}
}
return
buf
;
return
buf
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录