diff options
Diffstat (limited to 'cpp/src/Glacier2/Blobject.cpp')
-rw-r--r-- | cpp/src/Glacier2/Blobject.cpp | 510 |
1 files changed, 255 insertions, 255 deletions
diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index fb4f49d8772..bc5995fb547 100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp @@ -32,57 +32,57 @@ Glacier2::Blobject::Blobject(const CommunicatorPtr& communicator, bool reverse, _logger(_communicator->getLogger()), _reverse(reverse), _forwardContext(_reverse ? - _properties->getPropertyAsInt(serverForwardContext) > 0 : - _properties->getPropertyAsInt(clientForwardContext) > 0), + _properties->getPropertyAsInt(serverForwardContext) > 0 : + _properties->getPropertyAsInt(clientForwardContext) > 0), _buffered(_reverse ? - _properties->getPropertyAsIntWithDefault(serverBuffered, 1) > 0 : - _properties->getPropertyAsIntWithDefault(clientBuffered, 1) > 0), + _properties->getPropertyAsIntWithDefault(serverBuffered, 1) > 0 : + _properties->getPropertyAsIntWithDefault(clientBuffered, 1) > 0), _alwaysBatch(_reverse ? - _properties->getPropertyAsInt(serverAlwaysBatch) > 0 : - _properties->getPropertyAsInt(clientAlwaysBatch) > 0), + _properties->getPropertyAsInt(serverAlwaysBatch) > 0 : + _properties->getPropertyAsInt(clientAlwaysBatch) > 0), _requestTraceLevel(_reverse ? - _properties->getPropertyAsInt(serverTraceRequest) : - _properties->getPropertyAsInt(clientTraceRequest)), + _properties->getPropertyAsInt(serverTraceRequest) : + _properties->getPropertyAsInt(clientTraceRequest)), _overrideTraceLevel(reverse ? - _properties->getPropertyAsInt(serverTraceOverride) : - _properties->getPropertyAsInt(clientTraceOverride)), + _properties->getPropertyAsInt(serverTraceOverride) : + _properties->getPropertyAsInt(clientTraceOverride)), _sslContext(sslContext) { if(_buffered) { - try - { - IceUtil::Time sleepTime = _reverse ? - IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(serverSleepTime)) : - IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(clientSleepTime)); + try + { + IceUtil::Time sleepTime = _reverse ? + IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(serverSleepTime)) : + IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(clientSleepTime)); - const_cast<RequestQueuePtr&>(_requestQueue) = new RequestQueue(sleepTime); - - Int threadStackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize"); - - _requestQueue->start(static_cast<size_t>(threadStackSize)); + const_cast<RequestQueuePtr&>(_requestQueue) = new RequestQueue(sleepTime); + + Int threadStackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize"); + + _requestQueue->start(static_cast<size_t>(threadStackSize)); - // - // See the comment in Glacier2::RequestQueue::destroy() - // for why we detach the thread. - // - _requestQueue->getThreadControl().detach(); - } - catch(const IceUtil::Exception& ex) - { - { - Error out(_logger); - out << "cannot create thread for request queue:\n" << ex; - } + // + // See the comment in Glacier2::RequestQueue::destroy() + // for why we detach the thread. + // + _requestQueue->getThreadControl().detach(); + } + catch(const IceUtil::Exception& ex) + { + { + Error out(_logger); + out << "cannot create thread for request queue:\n" << ex; + } - if(_requestQueue) - { - _requestQueue->destroy(); - } - - throw; - } + if(_requestQueue) + { + _requestQueue->destroy(); + } + + throw; + } } } @@ -98,14 +98,14 @@ Glacier2::Blobject::destroy() void Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePtr& amdCB, - const std::pair<const Ice::Byte*, const Ice::Byte*>& inParams, const Current& current) + const std::pair<const Ice::Byte*, const Ice::Byte*>& inParams, const Current& current) { // // Set the correct facet on the proxy. // if(!current.facet.empty()) { - proxy = proxy->ice_facet(current.facet); + proxy = proxy->ice_facet(current.facet); } // @@ -115,13 +115,13 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePt if(current.requestId == 0) { if(_alwaysBatch && _buffered) - { - proxy = proxy->ice_batchOneway(); - } - else - { + { + proxy = proxy->ice_batchOneway(); + } + else + { proxy = proxy->ice_oneway(); - } + } } else if(current.requestId > 0) { @@ -134,229 +134,229 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePt Context::const_iterator p = current.ctx.find("_fwd"); if(p != current.ctx.end()) { - for(unsigned int i = 0; i < p->second.length(); ++i) - { - char option = p->second[i]; - switch(option) - { - case 't': - { - proxy = proxy->ice_twoway(); - break; - } - - case 'o': - { - if(_alwaysBatch && _buffered) - { - proxy = proxy->ice_batchOneway(); - } - else - { - proxy = proxy->ice_oneway(); - } - break; - } - - case 'd': - { - if(_alwaysBatch && _buffered) - { - proxy = proxy->ice_batchDatagram(); - } - else - { - proxy = proxy->ice_datagram(); - } - break; - } - - case 'O': - { - if(_buffered) - { - proxy = proxy->ice_batchOneway(); - } - else - { - proxy = proxy->ice_oneway(); - } - break; - } - - case 'D': - { - if(_buffered) - { - proxy = proxy->ice_batchDatagram(); - } - else - { - proxy = proxy->ice_datagram(); - } - break; - } - - case 's': - { - proxy = proxy->ice_secure(true); - break; - } - - case 'z': - { - proxy = proxy->ice_compress(true); - break; - } - - default: - { - Warning out(_logger); - out << "unknown forward option `" << option << "'"; - break; - } - } - } + for(unsigned int i = 0; i < p->second.length(); ++i) + { + char option = p->second[i]; + switch(option) + { + case 't': + { + proxy = proxy->ice_twoway(); + break; + } + + case 'o': + { + if(_alwaysBatch && _buffered) + { + proxy = proxy->ice_batchOneway(); + } + else + { + proxy = proxy->ice_oneway(); + } + break; + } + + case 'd': + { + if(_alwaysBatch && _buffered) + { + proxy = proxy->ice_batchDatagram(); + } + else + { + proxy = proxy->ice_datagram(); + } + break; + } + + case 'O': + { + if(_buffered) + { + proxy = proxy->ice_batchOneway(); + } + else + { + proxy = proxy->ice_oneway(); + } + break; + } + + case 'D': + { + if(_buffered) + { + proxy = proxy->ice_batchDatagram(); + } + else + { + proxy = proxy->ice_datagram(); + } + break; + } + + case 's': + { + proxy = proxy->ice_secure(true); + break; + } + + case 'z': + { + proxy = proxy->ice_compress(true); + break; + } + + default: + { + Warning out(_logger); + out << "unknown forward option `" << option << "'"; + break; + } + } + } } if(_requestTraceLevel >= 1) { - Trace out(_logger, "Glacier2"); - if(_reverse) - { - out << "reverse "; - } - out << "routing"; - if(_buffered) - { - out << " (buffered)"; - } - else - { - out << " (not buffered)"; - } - if(_reverse) - { - out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity()); - } - else - { - out << "\nproxy = " << _communicator->proxyToString(proxy); - } - out << "\noperation = " << current.operation; - out << "\ncontext = "; - Context::const_iterator q = current.ctx.begin(); - while(q != current.ctx.end()) - { - out << q->first << '/' << q->second; - if(++q != current.ctx.end()) - { - out << ", "; - } - } + Trace out(_logger, "Glacier2"); + if(_reverse) + { + out << "reverse "; + } + out << "routing"; + if(_buffered) + { + out << " (buffered)"; + } + else + { + out << " (not buffered)"; + } + if(_reverse) + { + out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity()); + } + else + { + out << "\nproxy = " << _communicator->proxyToString(proxy); + } + out << "\noperation = " << current.operation; + out << "\ncontext = "; + Context::const_iterator q = current.ctx.begin(); + while(q != current.ctx.end()) + { + out << q->first << '/' << q->second; + if(++q != current.ctx.end()) + { + out << ", "; + } + } } if(_buffered) { - // - // If we are in buffered mode, we create a new request and add - // it to the request queue. If the request is twoway, we use - // AMI. - // + // + // If we are in buffered mode, we create a new request and add + // it to the request queue. If the request is twoway, we use + // AMI. + // - bool override; - try - { - override = - _requestQueue->addRequest(new Request(proxy, inParams, current, _forwardContext, _sslContext, amdCB)); - } - catch(const ObjectNotExistException& ex) - { - amdCB->ice_exception(ex); - return; - } + bool override; + try + { + override = + _requestQueue->addRequest(new Request(proxy, inParams, current, _forwardContext, _sslContext, amdCB)); + } + catch(const ObjectNotExistException& ex) + { + amdCB->ice_exception(ex); + return; + } - if(override && _overrideTraceLevel >= 1) - { - Trace out(_logger, "Glacier2"); - if(_reverse) - { - out << "reverse "; - } - out << "routing override"; - if(_reverse) - { - out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity()); - } - else - { - out << "\nproxy = " << _communicator->proxyToString(proxy); - } - out << "\noperation = " << current.operation; - out << "\ncontext = "; - Context::const_iterator q = current.ctx.begin(); - while(q != current.ctx.end()) - { - out << q->first << '/' << q->second; - if(++q != current.ctx.end()) - { - out << ", "; - } - } - } + if(override && _overrideTraceLevel >= 1) + { + Trace out(_logger, "Glacier2"); + if(_reverse) + { + out << "reverse "; + } + out << "routing override"; + if(_reverse) + { + out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity()); + } + else + { + out << "\nproxy = " << _communicator->proxyToString(proxy); + } + out << "\noperation = " << current.operation; + out << "\ncontext = "; + Context::const_iterator q = current.ctx.begin(); + while(q != current.ctx.end()) + { + out << q->first << '/' << q->second; + if(++q != current.ctx.end()) + { + out << ", "; + } + } + } } else { - // - // If we are in not in buffered mode, we send the request - // directly. - // + // + // If we are in not in buffered mode, we send the request + // directly. + // - bool ok; - ByteSeq outParams; + bool ok; + ByteSeq outParams; - try - { - if(_forwardContext) - { - if(_sslContext.size() > 0) - { - Ice::Context ctx = current.ctx; - ctx.insert(_sslContext.begin(), _sslContext.end()); - ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, ctx); - } - else - { - ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx); - } - } - else - { - if(_sslContext.size() > 0) - { - ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, _sslContext); - } - else - { - ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams); - } - } + try + { + if(_forwardContext) + { + if(_sslContext.size() > 0) + { + Ice::Context ctx = current.ctx; + ctx.insert(_sslContext.begin(), _sslContext.end()); + ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, ctx); + } + else + { + ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx); + } + } + else + { + if(_sslContext.size() > 0) + { + ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, _sslContext); + } + else + { + ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams); + } + } - pair<const Byte*, const Byte*> outPair; - if(outParams.size() == 0) - { - outPair.first = outPair.second = 0; - } - else - { - outPair.first = &outParams[0]; - outPair.second = outPair.first + outParams.size(); - } - amdCB->ice_response(ok, outPair); - } - catch(const LocalException& ex) - { - amdCB->ice_exception(ex); - } + pair<const Byte*, const Byte*> outPair; + if(outParams.size() == 0) + { + outPair.first = outPair.second = 0; + } + else + { + outPair.first = &outParams[0]; + outPair.second = outPair.first + outParams.size(); + } + amdCB->ice_response(ok, outPair); + } + catch(const LocalException& ex) + { + amdCB->ice_exception(ex); + } } } |