}
// Do not do connection reclaim here since the connections
// are marked in use by registerWaiter() call and since this
// call happens later do it after that.
if (contactInfo.shouldCacheConnection()) {
OutboundConnectionCache connectionCache =
orb.getTransportManager()
.getOutboundConnectionCache(contactInfo);
connectionCache.stampTime(connection);
connectionCache.put(contactInfo, connection);
// connectionCache.reclaim();
}
}
}
}
CorbaMessageMediator messageMediator = (CorbaMessageMediator)
contactInfo.createMessageMediator(
orb, contactInfo, connection, opName, isOneWay);
if (orb.subcontractDebugFlag) {
dprint(".beginRequest: " + opAndId(messageMediator)
+ ": created message mediator: " + messageMediator);
}
// NOTE: Thread data so we can get the mediator in release reply
// in order to remove the waiter in CorbaConnection.
// We cannot depend on obtaining information in releaseReply
// via its InputStream argument since, on certain errors
// (e.g., client marshaling errors), the stream may be null.
// Likewise for releaseReply "self".
// NOTE: This must be done before initializing the message since
// that may start sending fragments which may end up in "early"
// replies or client marshaling exceptions.
orb.getInvocationInfo().setMessageMediator(messageMediator);
if (connection != null && connection.getCodeSetContext() == null) {
performCodeSetNegotiation(messageMediator);
}
addServiceContexts(messageMediator);
OutputObject outputObject =
contactInfo.createOutputObject(messageMediator);
if (orb.subcontractDebugFlag) {
dprint(".beginRequest: " + opAndId(messageMediator)
+ ": created output object: " + outputObject);
}
// NOTE: Not necessary for oneways, but useful for debugging.
// This must be done BEFORE message initialization since fragments
// may be sent at that time.
registerWaiter(messageMediator);
// Do connection reclaim now
synchronized (contactInfo) {
if (contactInfo.isConnectionBased()) {
if (contactInfo.shouldCacheConnection()) {
OutboundConnectionCache connectionCache =
orb.getTransportManager()
.getOutboundConnectionCache(contactInfo);
connectionCache.reclaim();
}
}
}
orb.getPIHandler().setClientPIInfo(messageMediator);