在JacORB 3中,可移植拦截器用于本地对象的实现方式发生了变化
发布说明中指出:“
为本地对象正确实现了可移植拦截器。
"
这种新的实施方式似乎引起了一些问题;重现问题的最简单方法
是从sas演示(jacorb附带的演示)中修改GssUpServer.java:
public class GssUpServer extends SASDemoPOA {
private ORB orb;
private boolean calledPrintSAS = false; // added
public GssUpServer(ORB orb) {
this.orb = orb;
}
public void printSAS() {
try {
org.omg.PortableInterceptor.Current current = (org.omg.PortableInterceptor.Current) orb
.resolve_initial_references("PICurrent");
org.omg.CORBA.Any anyName = current
.get_slot(org.jacorb.security.sas.SASInitializer.sasPrincipalNamePIC);
if (anyName.type().kind().value() == org.omg.CORBA.TCKind._tk_null) {
System.out.println("Null Name");
} else {
String name = anyName.extract_string();
System.out.println("printSAS for user " + name);
}
// /* added
if (!calledPrintSAS) {
calledPrintSAS = true;
// local call, (JacORB 3.x: throws NPE from SASClientInterceptor)
_this().printSAS();
}
// */
} catch (Exception e) {
e.printStackTrace();
}
}
...
}
GssUpClient.bat之后的堆栈跟踪:
2013-04-11 11:01:24.968 SEVERE unexpected exception during servant_preinvoke org.jacorb.security.sas.SASClientInterceptor.send_request(SASClientInterceptor.java:194)
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:129)
org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
org.jacorb.orb.DefaultClientInterceptorHandler.handle_send_request(DefaultClientInterceptorHandler.java:132)
org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2505)
org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
org.jacorb.demo.sas._SASDemoStub.printSAS(_SASDemoStub.java:73)
org.jacorb.demo.sas.GssUpServer.printSAS(GssUpServer.java:46)
org.jacorb.demo.sas.SASDemoPOA._invoke(SASDemoPOA.java:47)
org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:348)
org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:670)
org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:820)
java.lang.NullPointerException
at org.jacorb.security.sas.SASClientInterceptor.send_request(SASClientInterceptor.java:194)
at org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:129)
at org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
at org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
at org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
at org.jacorb.orb.DefaultClientInterceptorHandler.handle_send_request(DefaultClientInterceptorHandler.java:132)
at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2505)
at org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
at org.jacorb.demo.sas._SASDemoStub.printSAS(_SASDemoStub.java:73)
at org.jacorb.demo.sas.GssUpServer.printSAS(GssUpServer.java:46)
at org.jacorb.demo.sas.SASDemoPOA._invoke(SASDemoPOA.java:47)
at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:348)
at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:670)
at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:820)
上面的代码在JacORB 2.3.1中运行得非常好。解决此问题的简单方法是设置属性
jacorb.isLocalHistoricalInterceptors
真实;
然而,某些“内置”方法(例如。
_is_a()
)不尊重此标志(因为这些方法直接使用
is_really_local()
). 看起来
这些“内置”方法调用以前从未在本地进行调用时使用过拦截器。
因此,我的观察结果是:
-
JacORB3.x似乎破坏了一些用于本地调用的可移植拦截器(确切地说,需要连接对象的拦截器…)
-
JacORB3.x似乎是第一个使用便携式拦截器进行本地调用的JacORB
_is_()
,
_non_existent()
,
_interface()
,
_get_component()
第一个问题是可以解决的,因为有一个属性可以使JacORB3.x与旧版本一样工作。第二个(与第一个结合在一起)看起来真的很麻烦。
有没有其他人注意到这种行为,并且能够证实我的怀疑,这确实是JacORB3.x中的一个缺陷,或者我错过了什么?