boolean async )
throws ApplicationException, RemarshalException
{
checkORB();
RequestOutputStream ros = (RequestOutputStream)os;
ReplyReceiver receiver = null;
final ClientInterceptorHandler interceptors = new ClientInterceptorHandler
(
(ClientInterceptorHandler)localInterceptors.get(),
orb,
ros,
self,
this,
piorOriginal,
connection
);
orb.notifyTransportListeners (connection.getGIOPConnection());
if (orb.hasRequestInterceptors())
{
localInterceptors.set(interceptors);
try
{
interceptors.handle_send_request();
}
catch (RuntimeException e)
{
// If we are throwing a system exception then this will disrupt the call path.
// Therefore nullify localInterceptors so it doesn't appear we are still in an
// interceptor call. RemarshalExceptions are explicitely not caught, because in
// that case, localInterceptors must stay set
localInterceptors.set(null);
throw e;
}
}
else
{
interceptors.handle_send_request();
}
try
{
if ( !ros.response_expected() ) // oneway op
{
invoke_oneway (ros, interceptors);
return null;
}
// response expected, synchronous or asynchronous
receiver = new ReplyReceiver(this, ros.operation(), ros.getReplyEndTime(),
interceptors, replyHandler);
receiver.configure(configuration);
// Store the receiver in pending_replies, so in the
// case of a LocationForward a RemarshalException can
// be thrown to *all* waiting threads.
synchronized (pending_replies)
{
pending_replies.add(receiver);
}
ClientConnection cltconn = null;
synchronized (bind_sync)
{
if (ros.getConnection() != connection)
{
logger.debug("invoke: RemarshalException");
// RequestOutputStream has been created for
// another connection, so try again
throw new RemarshalException();
}
cltconn = connection;
}
// Use the local copy of the client connection to avoid trouble
// with something else affecting the real connection.
cltconn.sendRequest(ros, receiver, ros.requestId(), true);
}
catch ( org.omg.CORBA.SystemException cfe )
{
logger.debug("invoke: SystemException");