Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
8078c4c1
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看板
提交
8078c4c1
编写于
3月 20, 2013
作者:
M
mullan
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
b4f6ef71
960e88f0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
20 deletion
+45
-20
src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
...re/classes/sun/net/www/protocol/jar/JarURLConnection.java
+1
-1
src/solaris/classes/sun/net/www/protocol/jar/JarFileFactory.java
...aris/classes/sun/net/www/protocol/jar/JarFileFactory.java
+22
-10
src/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java
...dows/classes/sun/net/www/protocol/jar/JarFileFactory.java
+22
-9
未找到文件。
src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
浏览文件 @
8078c4c1
...
...
@@ -51,7 +51,7 @@ public class JarURLConnection extends java.net.JarURLConnection {
/* the Jar file factory. It handles both retrieval and caching.
*/
private
static
JarFileFactory
factory
=
new
JarFileFactory
();
private
static
final
JarFileFactory
factory
=
JarFileFactory
.
getInstance
();
/* the url for the Jar file */
private
URL
jarFileURL
;
...
...
src/solaris/classes/sun/net/www/protocol/jar/JarFileFactory.java
浏览文件 @
8078c4c1
...
...
@@ -43,13 +43,24 @@ import sun.net.util.URLUtil;
class
JarFileFactory
implements
URLJarFile
.
URLJarFileCloseController
{
/* the url to file cache */
private
static
HashMap
<
String
,
JarFile
>
fileCache
=
new
HashMap
<
String
,
JarFile
>();
private
static
final
HashMap
<
String
,
JarFile
>
fileCache
=
new
HashMap
<
>();
/* the file to url cache */
private
static
HashMap
<
JarFile
,
URL
>
urlCache
=
new
HashMap
<
JarFile
,
URL
>();
private
static
final
HashMap
<
JarFile
,
URL
>
urlCache
=
new
HashMap
<>();
private
static
final
JarFileFactory
instance
=
new
JarFileFactory
();
private
JarFileFactory
()
{
}
public
static
JarFileFactory
getInstance
()
{
return
instance
;
}
URLConnection
getConnection
(
JarFile
jarFile
)
throws
IOException
{
URL
u
=
urlCache
.
get
(
jarFile
);
URL
u
;
synchronized
(
instance
)
{
u
=
urlCache
.
get
(
jarFile
);
}
if
(
u
!=
null
)
return
u
.
openConnection
();
...
...
@@ -62,16 +73,16 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
JarFile
get
(
URL
url
,
boolean
useCaches
)
throws
IOException
{
JarFile
result
=
null
;
JarFile
local_result
=
null
;
JarFile
result
;
JarFile
local_result
;
if
(
useCaches
)
{
synchronized
(
this
)
{
synchronized
(
instance
)
{
result
=
getCachedJarFile
(
url
);
}
if
(
result
==
null
)
{
local_result
=
URLJarFile
.
getJarFile
(
url
,
this
);
synchronized
(
this
)
{
synchronized
(
instance
)
{
result
=
getCachedJarFile
(
url
);
if
(
result
==
null
)
{
fileCache
.
put
(
URLUtil
.
urlNoFragString
(
url
),
local_result
);
...
...
@@ -99,14 +110,15 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
* remove the JarFile from the cache
*/
public
void
close
(
JarFile
jarFile
)
{
URL
urlRemoved
=
urlCache
.
remove
(
jarFile
);
if
(
urlRemoved
!=
null
)
{
synchronized
(
instance
)
{
URL
urlRemoved
=
urlCache
.
remove
(
jarFile
);
if
(
urlRemoved
!=
null
)
fileCache
.
remove
(
URLUtil
.
urlNoFragString
(
urlRemoved
));
}
}
private
JarFile
getCachedJarFile
(
URL
url
)
{
assert
Thread
.
holdsLock
(
instance
);
JarFile
result
=
fileCache
.
get
(
URLUtil
.
urlNoFragString
(
url
));
/* if the JAR file is cached, the permission will always be there */
...
...
src/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java
浏览文件 @
8078c4c1
...
...
@@ -43,13 +43,24 @@ import sun.net.util.URLUtil;
class
JarFileFactory
implements
URLJarFile
.
URLJarFileCloseController
{
/* the url to file cache */
private
static
HashMap
<
String
,
JarFile
>
fileCache
=
new
HashMap
<
String
,
JarFile
>();
private
static
final
HashMap
<
String
,
JarFile
>
fileCache
=
new
HashMap
<
>();
/* the file to url cache */
private
static
HashMap
<
JarFile
,
URL
>
urlCache
=
new
HashMap
<
JarFile
,
URL
>();
private
static
final
HashMap
<
JarFile
,
URL
>
urlCache
=
new
HashMap
<>();
private
static
final
JarFileFactory
instance
=
new
JarFileFactory
();
private
JarFileFactory
()
{
}
public
static
JarFileFactory
getInstance
()
{
return
instance
;
}
URLConnection
getConnection
(
JarFile
jarFile
)
throws
IOException
{
URL
u
=
urlCache
.
get
(
jarFile
);
URL
u
;
synchronized
(
instance
)
{
u
=
urlCache
.
get
(
jarFile
);
}
if
(
u
!=
null
)
return
u
.
openConnection
();
...
...
@@ -72,16 +83,16 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
}
}
JarFile
result
=
null
;
JarFile
local_result
=
null
;
JarFile
result
;
JarFile
local_result
;
if
(
useCaches
)
{
synchronized
(
this
)
{
synchronized
(
instance
)
{
result
=
getCachedJarFile
(
url
);
}
if
(
result
==
null
)
{
local_result
=
URLJarFile
.
getJarFile
(
url
,
this
);
synchronized
(
this
)
{
synchronized
(
instance
)
{
result
=
getCachedJarFile
(
url
);
if
(
result
==
null
)
{
fileCache
.
put
(
URLUtil
.
urlNoFragString
(
url
),
local_result
);
...
...
@@ -109,13 +120,15 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
* remove the JarFile from the cache
*/
public
void
close
(
JarFile
jarFile
)
{
URL
urlRemoved
=
urlCache
.
remove
(
jarFile
);
if
(
urlRemoved
!=
null
)
{
synchronized
(
instance
)
{
URL
urlRemoved
=
urlCache
.
remove
(
jarFile
);
if
(
urlRemoved
!=
null
)
fileCache
.
remove
(
URLUtil
.
urlNoFragString
(
urlRemoved
));
}
}
private
JarFile
getCachedJarFile
(
URL
url
)
{
assert
Thread
.
holdsLock
(
instance
);
JarFile
result
=
fileCache
.
get
(
URLUtil
.
urlNoFragString
(
url
));
/* if the JAR file is cached, the permission will always be there */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录