throw e;
}
}
ClientConnection connectionToUse = null;
ReplyGroup group = null;
try
{
synchronized (bind_sync)
{
if ( ! bound )
{
// Somehow the connection got closed under us
throw new COMM_FAILURE("Connection closed");
}
else if (ros.getConnection() == connections[currentConnection.ordinal ()])
{
// RequestOutputStream has been created for
// exactly this connection
connectionToUse = connections[currentConnection.ordinal ()];
}
else
{
logger.debug("invoke: RemarshalException");
// RequestOutputStream has been created for
// another connection, so try again
throw new RemarshalException();
}
}
group = getReplyGroup (connectionToUse);
if ( !ros.response_expected() ) // oneway op
{
invoke_oneway (ros, connectionToUse, interceptors, group);
}
else
{
// response expected, synchronous or asynchronous
receiver = new ReplyReceiver(this, group,
ros.operation(),
ros.getReplyEndTime(),
interceptors, replyHandler, selectorManager);
try
{
receiver.configure(configuration);
}
catch (ConfigurationException ex)
{
logger.error ("Configuration problem with ReplyReceiver", ex);
throw new INTERNAL ("Caught configuration exception setting up ReplyReceiver.");
}
group.addHolder (receiver);
// Use the local copy of the client connection to avoid trouble
// with something else affecting the real connections[currentConnection].
connectionToUse.sendRequest(ros, receiver, ros.requestId(), true);
getParsedIOR ().markLastUsedProfile ();
}
}
catch ( org.omg.CORBA.SystemException cfe )
{
logger.debug("invoke[-->]: SystemException", cfe);
if( !async )
{
// Remove ReplyReceiver to break up reference cycle
// Otherwise gc will not detect this Delegate and
// will never finalize it.
if (group != null)
group.removeHolder(receiver);
}
try
{
interceptors.handle_receive_exception ( cfe );
}
catch (ForwardRequest fwd)
{
// Should not happen for remote requests
}
// The exception is a TRANSIENT, so try rebinding.
if ( cfe instanceof org.omg.CORBA.TRANSIENT && try_rebind (false))
{
throw new RemarshalException();
}
if (!(cfe instanceof org.omg.CORBA.TIMEOUT))
{
if (logger.isDebugEnabled())
{
logger.debug (this.toString() + " : invoke_internal: closing connection due to " + cfe.getMessage());
}
disconnect(connectionToUse);
}
throw cfe;
}
finally
{
if (orb.hasRequestInterceptors())
{
localInterceptors.set(null);
}
}
try
{
if ( !async && receiver != null )
{
// Synchronous invocation, response expected.
// This call blocks until the reply arrives.
org.omg.CORBA.portable.InputStream is = receiver.getReply();
((CDRInputStream)is).updateMutatorConnection (connectionToUse.getGIOPConnection());
if (clearCurrentContext)
{
clearInvocationContext();
}