Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
93ffbffb
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看板
提交
93ffbffb
编写于
6月 27, 2012
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6893617: JDK 6 CNCtx always uses the default ORB
Reviewed-by: lancea
上级
4eca6b55
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
57 deletion
+53
-57
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
+53
-57
未找到文件。
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
浏览文件 @
93ffbffb
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -58,8 +58,22 @@ public class CNCtx implements javax.naming.Context {
private
final
static
boolean
debug
=
false
;
/*
* Implement one shared ORB among all CNCtx. However, there is a public constructor
* accepting an ORB, so we need the option of using a given ORB.
*/
private
static
ORB
_defaultOrb
;
ORB
_orb
;
// used by ExceptionMapper and RMI/IIOP factory
public
NamingContext
_nc
;
// public for accessing underlying NamingContext
private
synchronized
static
ORB
getDefaultOrb
()
{
if
(
_defaultOrb
==
null
)
{
_defaultOrb
=
CorbaUtils
.
getOrb
(
null
,
-
1
,
new
Hashtable
<
String
,
java
.
lang
.
Object
>());
}
return
_defaultOrb
;
}
private
NameComponent
[]
_name
=
null
;
Hashtable
<
String
,
java
.
lang
.
Object
>
_env
;
// used by ExceptionMapper
...
...
@@ -114,8 +128,9 @@ public class CNCtx implements javax.naming.Context {
// rest is the INS name
// Return the parsed form to prevent subsequent lookup
// from parsing the string as a composite name
// The caller should be aware that a toString() of the name
// will yield its INS syntax, rather than a composite syntax
// The caller should be aware that a toString() of the name,
// which came from the environment will yield its INS syntax,
// rather than a composite syntax
return
new
ResolveResult
(
ctx
,
parser
.
parse
(
rest
));
}
...
...
@@ -135,10 +150,10 @@ public class CNCtx implements javax.naming.Context {
if
(
orb
==
null
||
nctx
==
null
)
throw
new
ConfigurationException
(
"Must supply ORB or NamingContext"
);
_orb
=
orb
;
orbTracker
=
tracker
;
if
(
orbTracker
!=
null
)
{
orbTracker
.
incRefCount
();
if
(
orb
!=
null
)
{
_orb
=
orb
;
}
else
{
_orb
=
getDefaultOrb
();
}
_nc
=
nctx
;
_env
=
env
;
...
...
@@ -212,10 +227,13 @@ public class CNCtx implements javax.naming.Context {
org
.
omg
.
CORBA
.
ORB
inOrb
=
null
;
String
ncIor
=
null
;
if
(
env
!=
null
)
{
if
(
inOrb
==
null
&&
env
!=
null
)
{
inOrb
=
(
org
.
omg
.
CORBA
.
ORB
)
env
.
get
(
"java.naming.corba.orb"
);
}
if
(
inOrb
==
null
)
inOrb
=
getDefaultOrb
();
// will create a default ORB if none exists
// Extract PROVIDER_URL from environment
String
provUrl
=
null
;
if
(
env
!=
null
)
{
...
...
@@ -226,13 +244,6 @@ public class CNCtx implements javax.naming.Context {
// Initialize the root naming context by using the IOR supplied
// in the PROVIDER_URL
ncIor
=
getStringifiedIor
(
provUrl
);
if
(
inOrb
==
null
)
{
// no ORB instance specified; create one using env and defaults
inOrb
=
CorbaUtils
.
getOrb
(
null
,
-
1
,
env
);
orbTracker
=
new
OrbReuseTracker
(
inOrb
);
}
setOrbAndRootContext
(
inOrb
,
ncIor
);
}
else
if
(
provUrl
!=
null
)
{
// Initialize the root naming context by using the URL supplied
...
...
@@ -258,14 +269,8 @@ public class CNCtx implements javax.naming.Context {
}
}
else
{
// No PROVIDER_URL supplied; initialize using defaults
if
(
inOrb
==
null
)
{
// No ORB instance specified; create one using env and defaults
inOrb
=
CorbaUtils
.
getOrb
(
null
,
-
1
,
env
);
orbTracker
=
new
OrbReuseTracker
(
inOrb
);
if
(
debug
)
{
System
.
err
.
println
(
"Getting default ORB: "
+
inOrb
+
env
);
}
if
(
debug
)
{
System
.
err
.
println
(
"Getting default ORB: "
+
inOrb
+
env
);
}
setOrbAndRootContext
(
inOrb
,
(
String
)
null
);
}
...
...
@@ -286,6 +291,10 @@ public class CNCtx implements javax.naming.Context {
*/
private
String
initUsingIiopUrl
(
ORB
defOrb
,
String
url
,
Hashtable
<?,?>
env
)
throws
NamingException
{
if
(
defOrb
==
null
)
defOrb
=
getDefaultOrb
();
try
{
IiopUrl
parsedUrl
=
new
IiopUrl
(
url
);
...
...
@@ -294,19 +303,17 @@ public class CNCtx implements javax.naming.Context {
for
(
IiopUrl
.
Address
addr
:
parsedUrl
.
getAddresses
())
{
try
{
if
(
defOrb
!=
null
)
{
try
{
String
tmpUrl
=
"corbaloc:iiop:"
+
addr
.
host
+
":"
+
addr
.
port
+
"/NameService"
;
if
(
debug
)
{
System
.
err
.
println
(
"Using url: "
+
tmpUrl
);
}
org
.
omg
.
CORBA
.
Object
rootCtx
=
defOrb
.
string_to_object
(
tmpUrl
);
setOrbAndRootContext
(
defOrb
,
rootCtx
);
return
parsedUrl
.
getStringName
();
}
catch
(
Exception
e
)
{}
// keep going
}
try
{
String
tmpUrl
=
"corbaloc:iiop:"
+
addr
.
host
+
":"
+
addr
.
port
+
"/NameService"
;
if
(
debug
)
{
System
.
err
.
println
(
"Using url: "
+
tmpUrl
);
}
org
.
omg
.
CORBA
.
Object
rootCtx
=
defOrb
.
string_to_object
(
tmpUrl
);
setOrbAndRootContext
(
defOrb
,
rootCtx
);
return
parsedUrl
.
getStringName
();
}
catch
(
Exception
e
)
{}
// keep going
// Get ORB
if
(
debug
)
{
...
...
@@ -314,12 +321,8 @@ public class CNCtx implements javax.naming.Context {
+
" and port "
+
addr
.
port
);
}
// Get ORB
ORB
orb
=
CorbaUtils
.
getOrb
(
addr
.
host
,
addr
.
port
,
env
);
orbTracker
=
new
OrbReuseTracker
(
orb
);
// Assign to fields
setOrbAndRootContext
(
o
rb
,
(
String
)
null
);
setOrbAndRootContext
(
defO
rb
,
(
String
)
null
);
return
parsedUrl
.
getStringName
();
}
catch
(
NamingException
ne
)
{
...
...
@@ -341,18 +344,16 @@ public class CNCtx implements javax.naming.Context {
*/
private
String
initUsingCorbanameUrl
(
ORB
orb
,
String
url
,
Hashtable
<?,?>
env
)
throws
NamingException
{
if
(
orb
==
null
)
orb
=
getDefaultOrb
();
try
{
CorbanameUrl
parsedUrl
=
new
CorbanameUrl
(
url
);
String
corbaloc
=
parsedUrl
.
getLocation
();
String
cosName
=
parsedUrl
.
getStringName
();
if
(
orb
==
null
)
{
// No ORB instance specified; create one using env and defaults
orb
=
CorbaUtils
.
getOrb
(
null
,
-
1
,
env
);
orbTracker
=
new
OrbReuseTracker
(
orb
);
}
setOrbAndRootContext
(
orb
,
corbaloc
);
return
parsedUrl
.
getStringName
();
...
...
@@ -1117,9 +1118,6 @@ public class CNCtx implements javax.naming.Context {
}
synchronized
public
void
incEnumCount
()
{
if
(
orbTracker
==
null
)
{
return
;
}
enumCount
++;
if
(
debug
)
{
System
.
out
.
println
(
"incEnumCount, new count:"
+
enumCount
);
...
...
@@ -1128,9 +1126,6 @@ public class CNCtx implements javax.naming.Context {
synchronized
public
void
decEnumCount
()
throws
NamingException
{
if
(
orbTracker
==
null
)
{
return
;
}
enumCount
--;
if
(
debug
)
{
System
.
out
.
println
(
"decEnumCount, new count:"
+
enumCount
+
...
...
@@ -1142,14 +1137,15 @@ public class CNCtx implements javax.naming.Context {
}
synchronized
public
void
close
()
throws
NamingException
{
if
(
orbTracker
==
null
)
{
return
;
}
if
(
enumCount
>
0
)
{
isCloseCalled
=
true
;
return
;
}
orbTracker
.
decRefCount
();
// Never destroy an orb in CNCtx.
// The orb we have is either the shared/default orb, or one passed in to a constructor
// from elsewhere, so that orb is somebody else's reponsibility.
}
protected
void
finalize
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录