本文整理汇总了C++中TAO_ServerRequest::sync_with_server方法的典型用法代码示例。如果您正苦于以下问题:C++ TAO_ServerRequest::sync_with_server方法的具体用法?C++ TAO_ServerRequest::sync_with_server怎么用?C++ TAO_ServerRequest::sync_with_server使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAO_ServerRequest
的用法示例。
在下文中一共展示了TAO_ServerRequest::sync_with_server方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
DSI_Simple_Server::_dispatch (TAO_ServerRequest &request, TAO::Portable_Server::Servant_Upcall *)
{
// No need to do any of this if the client isn't waiting.
if (request.response_expected ())
{
if (!CORBA::is_nil (request.forward_location ()))
{
request.init_reply ();
request.tao_send_reply ();
// No need to invoke in this case.
return;
}
else if (request.sync_with_server ())
{
// The last line before the call to this function
// was an ACE_CHECK_RETURN, so if we're here, we
// know there is no exception so far, and that's all
// a SYNC_WITH_SERVER client request cares about.
request.send_no_exception_reply ();
}
}
// Create DSI request object.
CORBA::ServerRequest *dsi_request = 0;
ACE_NEW (dsi_request,
CORBA::ServerRequest (request));
try
{
TAO_AMH_DSI_Response_Handler_ptr rh_ptr;
ACE_NEW (rh_ptr, TAO_AMH_DSI_Response_Handler(request));
TAO_AMH_DSI_Response_Handler_var rh(rh_ptr);
rh->init (request, 0);
// Delegate to user.
this->invoke (dsi_request, rh.in());
}
catch (const CORBA::Exception& ex)
{
// Only if the client is waiting.
if (request.response_expected () && !request.sync_with_server ())
{
request.tao_send_reply_exception (ex);
}
}
CORBA::release (dsi_request);
}
示例2: if
TAO::CSD::Strategy_Base::DispatchResult
TAO_DTP_POA_Strategy::dispatch_collocated_request_i
(TAO_ServerRequest& server_request,
const PortableServer::ObjectId& object_id,
PortableServer::POA_ptr poa,
const char* operation,
PortableServer::Servant servant)
{
TAO::CSD::TP_Servant_State::HandleType servant_state =
this->get_servant_state (servant);
bool is_sync_with_server = server_request.sync_with_server ();
bool is_synchronous = server_request.response_expected ();
TAO::CSD::TP_Collocated_Synch_Request_Handle
synch_request;
TAO::CSD::TP_Collocated_Synch_With_Server_Request_Handle
synch_with_server_request;
TAO::CSD::TP_Request_Handle
request;
// Create the request object using the appropriate concrete type.
if (is_sync_with_server)
{
TAO::CSD::TP_Collocated_Synch_With_Server_Request *req_ptr;
ACE_NEW_RETURN (req_ptr,
TAO::CSD::TP_Collocated_Synch_With_Server_Request
(server_request,
object_id,
poa,
operation,
servant,
servant_state.in ()),
DISPATCH_REJECTED);
synch_with_server_request = req_ptr;
// Give the request handle its own "copy".
synch_with_server_request->_add_ref ();
request = synch_with_server_request.in ();
}
else if (is_synchronous)
{
TAO::CSD::TP_Collocated_Synch_Request *req_ptr;
ACE_NEW_RETURN (req_ptr,
TAO::CSD::TP_Collocated_Synch_Request (
server_request,
object_id,
poa,
operation,
servant,
servant_state.in ()),
DISPATCH_REJECTED);
synch_request = req_ptr;
// Give the request handle its own "copy".
synch_request->_add_ref ();
request = synch_request.in ();
}
else
{
TAO::CSD::TP_Collocated_Asynch_Request *req_ptr;
ACE_NEW_RETURN (req_ptr,
TAO::CSD::TP_Collocated_Asynch_Request (server_request,
object_id,
poa,
operation,
servant,
servant_state.in ()),
DISPATCH_REJECTED);
// Just use the (base) request handle to hold the request object.
request = req_ptr;
}
// Hand the request object to our task so that it can add the request
// to its "request queue".
if (!this->dtp_task_.add_request (request.in ()))
{
// Return the DISPATCH_REJECTED return code so that the caller (our
// base class' dispatch_request() method) knows that we did
// not handle the request, and that it should be rejected.
return DISPATCH_REJECTED;
}
// We need to wait on the request object if the request type is a
// synchronous request.
if (!synch_request.is_nil ())
{
int srw = synch_request->wait ();
if (srw == false)
{
// Raise exception when request was cancelled.
throw ::CORBA::NO_IMPLEMENT ();
}
}
//.........这里部分代码省略.........
示例3: if
void
TAO_DynamicImplementation::_dispatch (
TAO_ServerRequest &request,
TAO::Portable_Server::Servant_Upcall * /* context */)
{
// No need to do any of this if the client isn't waiting.
if (request.response_expected ())
{
if (request.is_forwarded ())
{
request.init_reply ();
request.tao_send_reply ();
// No need to invoke in this case.
return;
}
else if (request.sync_with_server ())
{
// The last line before the call to this function
// was an ACE_CHECK_RETURN, so if we're here, we
// know there is no exception so far, and that's all
// a SYNC_WITH_SERVER client request cares about.
request.send_no_exception_reply ();
}
}
// Create DSI request object.
CORBA::ServerRequest *dsi_request = 0;
ACE_NEW (dsi_request,
CORBA::ServerRequest (request));
try
{
// Delegate to user.
this->invoke (dsi_request);
// Only if the client is waiting.
if (request.response_expected () && !request.sync_with_server ())
{
dsi_request->dsi_marshal ();
}
}
catch (::CORBA::Exception& ex)
{
// Only if the client is waiting.
if (request.response_expected () && !request.sync_with_server ())
{
if (request.collocated ()
&& request.operation_details ()->cac () != 0)
{
// If we have a cac it will handle the exception and no
// need to do any further processing
request.operation_details ()->cac ()->handle_corba_exception (
request, &ex);
return;
}
else
request.tao_send_reply_exception (ex);
}
}
::CORBA::release (dsi_request);
}