// Run ServantLocator::postinvoke. This may cause a SystemException
// which will throw out of the constructor and return later
// to construct a reply for that exception. The internal logic
// of returnServant makes sure that postinvoke is only called once.
// REVISIT: instead of instanceof, put method on all orbs.
ORB orb = null;
// This flag is to deal with BootstrapServer use of reply streams,
// with ServerRequestDispatcher's use of reply streams, etc.
if (messageMediator.executeReturnServantInResponseConstructor()) {
// It is possible to get marshaling errors in the skeleton after
// postinvoke has completed. We must set this to false so that
// when the error exception reply is constructed we don't try
// to incorrectly access poa current (which will be the wrong
// one or an empty stack.
messageMediator.setExecuteReturnServantInResponseConstructor(false);
messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(true);
try {
orb = (ORB)messageMediator.getBroker();
OAInvocationInfo info = orb.peekInvocationInfo() ;
ObjectAdapter oa = info.oa();
try {
oa.returnServant() ;
} catch (Throwable thr) {
wrapper.unexpectedException( thr ) ;