}
}
public void dispatch(MessageMediator messageMediator)
{
CorbaMessageMediator request = (CorbaMessageMediator) messageMediator;
try {
if (orb.subcontractDebugFlag) {
dprint(".dispatch->: " + opAndId(request));
}
// to set the codebase information, if any transmitted; and also
// appropriate ORB Version.
consumeServiceContexts(request);
// Now that we have the service contexts processed and the
// correct ORBVersion set, we must finish initializing the
// stream.
((MarshalInputStream)request.getInputObject())
.performORBVersionSpecificInit();
ObjectKey okey = request.getObjectKey();
// Check that this server is the right server
try {
checkServerId(okey);
} catch (ForwardException fex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": bad server id");
}
request.getProtocolHandler()
.createLocationForward(request, fex.getIOR(), null);
return;
}
String operation = request.getOperationName();
ObjectAdapter objectAdapter = null ;
try {
byte[] objectId = okey.getId().getId() ;
ObjectKeyTemplate oktemp = okey.getTemplate() ;
objectAdapter = findObjectAdapter(oktemp);
java.lang.Object servant = getServantWithPI(request, objectAdapter,
objectId, oktemp, operation);
dispatchToServant(servant, request, objectId, objectAdapter);
} catch (ForwardException ex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": ForwardException caught");
}
// Thrown by Portable Interceptors from InterceptorInvoker,
// through Response constructor.
request.getProtocolHandler()
.createLocationForward(request, ex.getIOR(), null);
} catch (OADestroyed ex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": OADestroyed exception caught");
}
// DO NOT CALL THIS HERE:
// releaseServant(objectAdapter);
// The problem is that OADestroyed is only thrown by oa.enter, in
// which case oa.exit should NOT be called, and neither should
// the invocationInfo stack be popped.
// Destroyed POAs can be recreated by normal adapter activation.
// So just restart the dispatch.
dispatch(request);
} catch (RequestCanceledException ex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": RequestCanceledException caught");
}
// IDLJ generated non-tie based skeletons do not catch the
// RequestCanceledException. Rethrow the exception, which will
// cause the worker thread to unwind the dispatch and wait for
// other requests.
throw ex;
} catch (UnknownException ex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": UnknownException caught " + ex);
}
// RMIC generated tie skeletons convert all Throwable exception
// types (including RequestCanceledException, ThreadDeath)
// thrown during reading fragments into UnknownException.
// If RequestCanceledException was indeed raised,
// then rethrow it, which will eventually cause the worker
// thread to unstack the dispatch and wait for other requests.
if (ex.originalEx instanceof RequestCanceledException) {
throw (RequestCanceledException) ex.originalEx;
}
ServiceContexts contexts = new ServiceContexts(orb);
UEInfoServiceContext usc = new UEInfoServiceContext(
ex.originalEx);
contexts.put( usc ) ;
SystemException sysex = wrapper.unknownExceptionInDispatch(
CompletionStatus.COMPLETED_MAYBE, ex ) ;
request.getProtocolHandler()
.createSystemExceptionResponse(request, sysex,
contexts);
} catch (Throwable ex) {
if (orb.subcontractDebugFlag) {
dprint(".dispatch: " + opAndId(request)
+ ": other exception " + ex);
}
request.getProtocolHandler()
.handleThrowableDuringServerDispatch(
request, ex, CompletionStatus.COMPLETED_MAYBE);
}
return;
} finally {