SUGGESTED FIX
here are the diffs (note that the code should be mostly the same as
JDK 6u12, but the line numbers are different)
diff -r 5de73d2d685e src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Mon Dec 01 13:38:26 2008 -0800
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Thu Dec 18 15:44:42 2008 -0800
@@ -2199,6 +2199,12 @@
return entry ;
}
+
+ @Override
+ public synchronized boolean orbIsShutdown() {
+ return ((status == STATUS_DESTROYED) ||
+ (status == STATUS_SHUTDOWN)) ;
+ }
} // Class ORBImpl
////////////////////////////////////////////////////////////////////////
diff -r 5de73d2d685e src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
--- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java Mon Dec 01 13:38:26 2008 -0800
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java Thu Dec 18 15:44:42 2008 -0800
@@ -1771,6 +1771,9 @@
dprint(".handleRequest: " + opAndId(messageMediator)
+ ": sending response");
}
+ if (orb.orbIsShutdown())
+ return ;
+
// REVISIT - type and location
CDROutputObject outputObject = (CDROutputObject)
messageMediator.getOutputObject();
@@ -1786,6 +1789,8 @@
if (orb.subcontractDebugFlag) {
dprint(".handleRequest<-: " + opAndId(messageMediator));
}
+ if (orb.orbIsShutdown())
+ return ;
// release NIO ByteBuffers to ByteBufferPool
@@ -1816,9 +1821,8 @@
((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader();
ORB orb = (ORB)messageMediator.getBroker();
- synchronized( orb ) {
- orb.checkShutdownState();
- }
+ if (orb.orbIsShutdown())
+ return ;
ObjectKey okey = messageMediator.getObjectKeyCacheEntry().getObjectKey();
if (orb.subcontractDebugFlag) {
diff -r 5de73d2d685e src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
--- a/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Mon Dec 01 13:38:26 2008 -0800
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Thu Dec 18 15:44:42 2008 -0800
@@ -189,8 +189,11 @@
if (eventHandler.shouldUseSelectThreadToWait()) {
SelectionKey selectionKey = eventHandler.getSelectionKey();
- selectionKey.cancel();
- selector.wakeup();
+ if (selectionKey != null) {
+ selectionKey.cancel();
+ selector.wakeup();
+ }
+
return;
}
diff -r 5de73d2d685e src/share/classes/com/sun/corba/se/spi/orb/ORB.java
--- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Mon Dec 01 13:38:26 2008 -0800
+++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Thu Dec 18 15:44:42 2008 -0800
@@ -615,6 +615,12 @@
return null ;
}
+ /** Return whether or not the ORB is shutdown. A shutdown ORB cannot process
+ * incoming requests.
+ */
+ public boolean orbIsShutdown() {
+ return true ;
+ }
}
|
EVALUATION
I've found two problems here that need to be fixed.
First, the SelectorImpl.unregisterForEvent code needs to check for a null
seclectionKey and avoid the NPE>
Second, the code in CorbaMessageMediatorImpl checks for an ORB shutdown by
calling ORBImpl.checkShutdownState, and this throws an unwanted exception.
The fix required here is to add another accessor method on the ORB to find out
if the ORB is shutdown, in which case do NOT handle the incoming message.
This will avoid most of the spurious log messages, thought perhaps one could occasionally
happen if the ORB is shutdown after the check.
|