本文整理汇总了C++中portableinterceptor::ServerRequestInfo_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ ServerRequestInfo_ptr类的具体用法?C++ ServerRequestInfo_ptr怎么用?C++ ServerRequestInfo_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServerRequestInfo_ptr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void
EDF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
RTScheduling::Current::IdType_out guid_out,
CORBA::String_out /*name*/,
CORBA::Policy_out sched_param_out,
CORBA::Policy_out /*implicit_sched_param_out*/)
{
Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr;
RTScheduling::Current::IdType guid;
int int_guid;
DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_SERVER_SCHED_TIME, 0, 0, 0);
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered EDF_Scheduler::receive_request\n"));
#endif
CORBA::String_var operation = ri->operation ();
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T): receive_request from "
"\"%s\"\n",
operation.in ()));
#endif
// Ignore the "_is_a" operation since it may have been invoked
// locally on the server side as a side effect of another call,
// meaning that the client hasn't added the service context yet.
if (ACE_OS::strcmp ("_is_a", operation.in ()) == 0)
return;
IOP::ServiceContext_var sc =
ri->get_request_service_context (Server_Interceptor::SchedulingInfo);
CORBA::Long importance;
TimeBase::TimeT deadline;
TimeBase::TimeT period;
CORBA::Long task_id=-1;
if (sc.ptr () == 0)
{
//Since send_request will add an QoS for any request, why can this case happen?
//24 hrs from now - infinity
ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0);
deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT
importance = 0;
period = 0;
// task_id = ID_BEGIN ++;
}
else
{
CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (),
sc->context_data.length (),
sc->context_data.get_buffer (),
0);
CORBA::Any sc_qos_as_any;
CORBA::Any_var scqostmp = codec_->decode (oc_seq);
sc_qos_as_any = scqostmp.in ();
//Don't store in a _var, since >>= returns a pointer to an
//internal buffer and we are not supposed to free it.
sc_qos_as_any >>= sc_qos_ptr;
deadline = sc_qos_ptr->deadline;
importance = sc_qos_ptr->importance;
period = sc_qos_ptr->period;
task_id = sc_qos_ptr->task_id;
guid.length (sc_qos_ptr->guid.length ());
guid_copy (guid, sc_qos_ptr->guid);
ACE_NEW (guid_out.ptr (),
RTScheduling::Current::IdType);
guid_out.ptr ()->length (guid.length ());
*(guid_out.ptr ()) = guid;
ACE_OS::memcpy (&int_guid,
guid.get_buffer (),
guid.length ());
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T): Importance = %d, guid = %d "
"in recvd service context\n",
importance,
int_guid));
#endif
EDF_Scheduling::SchedulingParameter sched_param;
sched_param.importance = importance;
sched_param.deadline = deadline;
sched_param.period = period;
sched_param.task_id = task_id;
sched_param_out = this->create_scheduling_parameter (sched_param);
}
//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:EDF_Scheduler.cpp
示例2: ForwardRequest
void
Echo_Server_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
ACE_DEBUG ((LM_DEBUG,
"%C.receive_request_service_contexts from "
"\"%C\"\n",
this->myname_,
operation.in ()));
// Ignore the "_is_a" operation since it may have been invoked
// locally on the server side as a side effect of another call,
// meaning that the client hasn't added the service context yet.
// Same goes for the shutdown call
if (ACE_OS_String::strcmp ("shutdown", operation.in ()) == 0)
return;
IOP::ServiceId id = ::service_id;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
const char *buf =
reinterpret_cast<const char *> (sc->context_data.get_buffer ());
ACE_DEBUG ((LM_DEBUG,
" Received service context: %C\n",
buf));
if (ACE_OS::strcmp (buf, request_msg) == 0)
{
ACE_DEBUG ((LM_DEBUG, "Sending LOCATION_FORWARD\n"));
throw PortableInterceptor::ForwardRequest (this->forward_location_.in ());
}
else if (ACE_OS::strcmp (buf, forward_msg) == 0)
{
// Make the context to send the context to the client
IOP::ServiceContext scc;
scc.context_id = ::service_id;
CORBA::ULong string_len = ACE_OS::strlen (reply_msg) + 1;
CORBA::Octet *buff = CORBA::OctetSeq::allocbuf (string_len);
ACE_OS::strcpy (reinterpret_cast<char *> (buff), reply_msg);
scc.context_data.replace (string_len, string_len, buff, 1);
// Add this context to the service context list.
ri->add_reply_service_context (scc, 0);
}
else
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: "
"Expected request service context to be: %C or %C\n",
request_msg,
forward_msg));
}
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:60,代码来源:server_interceptor.cpp
示例3: catch
void
ServerRequest_Interceptor2::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var op = ri->operation ();
if (ACE_OS::strcmp (op.in (), "has_ft_request_service_context"))
{
// bail if not the op we are interested in -
// avoid excess spurious error clutter when client calls ::shutdown; ::ping etc..
return;
}
try
{
IOP::ServiceContext_var sc =
ri->get_request_service_context (IOP::FT_REQUEST);
// No exception therefore there was a context
has_ft_request_sc_ = true;
}
catch (const CORBA::BAD_PARAM& ex)
{
ACE_UNUSED_ARG (ex);
// No group version context
has_ft_request_sc_ = false;
}
catch (const CORBA::Exception&)
{
throw;
}
}
开发者ID:CCJY,项目名称:ATCD,代码行数:32,代码来源:ServerRequest_Interceptor2.cpp
示例4:
void
Echo_Server_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
ACE_DEBUG ((LM_DEBUG,
"%C.receive_request_service_contexts from "
"\"%C\"\n",
this->myname_,
operation.in ()));
IOP::ServiceId id = ::service_id;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
const char *buf =
reinterpret_cast<const char *> (sc->context_data.get_buffer ());
#if 0
ACE_DEBUG ((LM_DEBUG,
" Received service context: %C\n",
buf));
#endif /*if 0*/
if (ACE_OS::strcmp (buf, request_msg) != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: "
"Expected request service context to be: %C\n",
request_msg));
}
}
开发者ID:Tim-Sun,项目名称:ACE-TAO-CIAO-6.2.3-gnu,代码行数:34,代码来源:server_interceptor.cpp
示例5:
void
ServerInterceptor::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
bool permission_granted = false;
std::cout << "Calling receive_request()." << std::endl;
if (ri->target_is_a(restricted_interfaces[0])){
IOP::ServiceId id = service_id;
// Check that the request service context can be retrieved.
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
CORBA::OctetSeq ocSeq = sc->context_data;
const char * buf =
reinterpret_cast<const char *> (ocSeq.get_buffer ());
for (unsigned int i=0; i<num_allowed_users; ++i) {
if (ACE_OS::strcmp (buf, allowed_users[i]) == 0)
{
permission_granted = true;
}
}
}
if (permission_granted == true) {
std::cout << "Permission Granted " << std::endl;
}
else {
std::cout << "Permission Denied " << std::endl;;
}
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:33,代码来源:ServerInterceptor.cpp
示例6: INTERNAL
void
Echo_Server_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
ACE_DEBUG ((LM_DEBUG,
"%C.receive_request_service_contexts from "
"\"%C\"\n",
this->myname_,
operation.in ()));
// Ignore the shutdown operation.
if (ACE_OS_String::strcmp ("shutdown", operation.in ()) == 0)
return;
// retrieve the context
IOP::ServiceId id = ::service_id;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
const char *buf =
reinterpret_cast<const char *> (sc->context_data.get_buffer ());
ACE_DEBUG ((LM_DEBUG,
" Received service context: %C\n",
buf));
if (ACE_OS::strcmp (buf, request_msg) != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: "
"Expected request service context to be: %C\n",
request_msg ));
}
else
{
// put the context into s slot
CORBA::Any data;
data <<= buf;
try
{
ri->set_slot (slotId, data);
ACE_DEBUG ((LM_DEBUG, "receive_request_service_contexts filled Slot %d\n",(int)slotId));
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (
"Exception thrown in receive_request_service_contexts()\n");
throw CORBA::INTERNAL ();
}
}
}
开发者ID:asdlei00,项目名称:ACE,代码行数:55,代码来源:server_interceptor.cpp
示例7:
void
Echo_Server_Request_Interceptor::send_exception (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
#if 0
ACE_DEBUG ((LM_DEBUG,
"%C.send_exception from \"%C\"\n",
this->myname_,
operation.in ()));
#endif /*if 0*/
// Check that the reply service context is set as expected.
IOP::ServiceContext_var sc =
ri->get_reply_service_context (::service_id);
const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ());
#if 0
ACE_DEBUG ((LM_DEBUG,
" Reply service context: %C\n",
buf));
#endif /*if 0*/
if (ACE_OS::strcmp (buf, reply_msg) != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::send_exception: "
"Expected reply service context to be: %C\n",
reply_msg));
}
// Check that the request service context hasn't been changed.
IOP::ServiceContext_var sc2 =
ri->get_request_service_context (::service_id);
const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ());
if (ACE_OS::strcmp (buf2, request_msg) != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::send_exception: "
"Expected request service context to be: %C.\n"
" Got: %C\n",
request_msg,
buf2));
}
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:50,代码来源:server_interceptor.cpp
示例8: ForwardRequest
void
Server_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
this->request_count_++;
CORBA::Boolean response_expected =
ri->response_expected ();
if (!response_expected) // A one-way request.
return;
// Request 1 -- non-forwarded
// Request 2 -- forwarded by client request interceptor
// Request 3 -- forwarded by this interception point
if (this->request_count_ == 3)
{
// The client request interceptor should have already forwarded
// the request to obj_[1], so we re-forward the request back to
// obj_[0].
ACE_DEBUG ((LM_DEBUG,
"SERVER (%P|%t) Request %d will be forwarded "
"to object 1\n" // "object 1" as in "obj_[0]"
"SERVER (%P|%t) via "
"receive_request_service_contexts().\n",
this->request_count_));
throw PortableInterceptor::ForwardRequest (this->obj_[0]);
}
}
开发者ID:manut,项目名称:TAO,代码行数:32,代码来源:Server_Request_Interceptor.cpp
示例9: ForwardRequest
void
ForwardTest_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
ACE_DEBUG ((LM_DEBUG,
"%C.receive_request_service_contexts from "
"\"%C\"\n",
this->myname_,
operation.in ()));
// Ignore the "_is_a" operation since it may have been invoked
// locally on the server side as a side effect of another call,
// meaning that the client hasn't added the service context yet.
// Same goes for the shutdown call
if (ACE_OS_String::strcmp ("_is_a", operation.in ()) == 0 ||
ACE_OS_String::strcmp ("shutdown", operation.in ()) == 0)
return;
if (!forward_location_done_)
{
forward_location_done_ = true;
ACE_DEBUG ((LM_DEBUG,
"Sending LOCATION_FORWARD, current thread %i\n",
ACE_Thread::self ()));
throw PortableInterceptor::ForwardRequest (
CORBA::Object::_duplicate (this->forward_location_.in ()));
}
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:server_interceptor.cpp
示例10: INTERNAL
void
Server_Request_Interceptor::send_other (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::Boolean response_expected =
ri->response_expected ();
if (!response_expected) // A one-way request.
return;
// If we get this far then we should have received a
// LOCATION_FORWARD reply.
// This will throw an exception if a location forward has not
// occured. If an exception is thrown then something is wrong with
// the PortableInterceptor::ForwardRequest support.
CORBA::Object_var forward = ri->forward_reference ();
if (CORBA::is_nil (forward.in ()))
throw CORBA::INTERNAL ();
}
开发者ID:manut,项目名称:TAO,代码行数:21,代码来源:Server_Request_Interceptor.cpp
示例11:
void
IIOP_Server_Request_Interceptor::outbound_process_context (PortableInterceptor::ServerRequestInfo_ptr ri)
{
IOP::ServiceId id = Test::Transport::CurrentTest::ContextTag;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
const char *buf =
reinterpret_cast <const char *> (sc->context_data.get_buffer ());
this->pop_request_info (ACE_OS::atoi (buf));
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:13,代码来源:IIOP_Server_Request_Interceptor.cpp
示例12: INTERNAL
void
ForwardTest_Request_Interceptor::send_other (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
// This will throw an exception if a location forward has not
// occured. If an exception is thrown then something is wrong with
// the PortableInterceptor::ForwardRequest support.
CORBA::Object_var forward = ri->forward_reference ();
if (CORBA::is_nil (forward.in ()))
throw CORBA::INTERNAL ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:13,代码来源:server_interceptor.cpp
示例13: BAD_PARAM
void
Echo_Server_Request_Interceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation =
ri->operation ();
if (ACE_OS::strcmp ("_is_a", operation.in ()) == 0)
return;
IOP::ServiceId id = ::service_id;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
if (sc->context_data.length() != magic_cookie_len
|| ACE_OS::memcmp(
magic_cookie, sc->context_data.get_buffer(),
magic_cookie_len) != 0)
{
throw CORBA::BAD_PARAM();
}
}
开发者ID:asdlei00,项目名称:ACE,代码行数:22,代码来源:Server_Interceptor.cpp
示例14: INTERNAL
void
Echo_Server_Request_Interceptor::send_other (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var operation = ri->operation ();
ACE_DEBUG ((LM_DEBUG,
"%C.send_other from \"%C\"\n",
this->myname_,
operation.in ()));
// Check that the request service context hasn't been changed.
IOP::ServiceContext_var sc =
ri->get_request_service_context (::service_id);
const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ());
if (ACE_OS::strcmp (buf, request_msg) != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Echo_Server_Request_Interceptor::send_reply: "
"Expected request service context to be: %C.\n"
" Got: %C\n",
request_msg,
buf));
}
// If we get this far then we should have received a
// LOCATION_FORWARD reply.
// This will throw an exception if a location forward has not
// occurred. If an exception is thrown then something is wrong with
// the PortableInterceptor::ForwardRequest support.
CORBA::Object_var forward = ri->forward_reference ();
if (CORBA::is_nil (forward.in ()))
throw CORBA::INTERNAL ();
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:38,代码来源:server_interceptor.cpp
示例15: name
void
IIOP_Server_Request_Interceptor::inbound_process_context (PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::String_var name (this->name ());
CORBA::String_var op (ri->operation());
if (TAO_debug_level >=1)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("%C (%P|%t) Intercepted operation %C ()\n"),
name.in (),
op.in ()));
try
{
IOP::ServiceId id = Test::Transport::CurrentTest::ContextTag;
IOP::ServiceContext_var sc =
ri->get_request_service_context (id);
const char *buf =
reinterpret_cast <const char *> (sc->context_data.get_buffer ());
long requestID = ACE_OS::atoi (buf);
this->push_request_info (requestID);
}
catch (const CORBA::Exception&)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%C (%P|%t) Service context")
ACE_TEXT (" is unavailable when invoking %C (). ")
ACE_TEXT ("A colocated invocation would have ")
ACE_TEXT ("no service context.\n"),
name.in (),
op.in ()));
}
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:37,代码来源:IIOP_Server_Request_Interceptor.cpp
示例16:
void
TAO_LB_ServerRequestInterceptor::send_other (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
if (TAO_debug_level > 0)
{
// A location forward occurs when the LoadManager informs the
// LoadAlert object that its member is overloaded, for example.
const PortableInterceptor::ReplyStatus status =
ri->reply_status ();
if (status == PortableInterceptor::LOCATION_FORWARD)
ORBSVCS_DEBUG ((LM_INFO,
ACE_TEXT ("TAO_LB_ServerRequestInterceptor -- ")
ACE_TEXT ("LOCATION FORWARDED\n")));
}
}
开发者ID:CCJY,项目名称:ATCD,代码行数:18,代码来源:LB_ServerRequestInterceptor.cpp
示例17: sizeof
void
TAO_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info,
RTScheduling::Current::IdType_out guid_out,
CORBA::String_out /*name*/,
CORBA::Policy_out /*sched_param*/,
CORBA::Policy_out /*implicit_sched_param*/)
{
IOP::ServiceContext_var serv_cxt;
try
{
serv_cxt = request_info->get_request_service_context (Server_Interceptor::SchedulingInfo);
size_t gu_id;
ACE_OS::memcpy (&gu_id,
serv_cxt->context_data.get_buffer (),
serv_cxt->context_data.length ());
ACE_DEBUG ((LM_DEBUG,
"The Guid is %d\n",
gu_id));
RTScheduling::Current::IdType* guid;
ACE_NEW (guid,
RTScheduling::Current::IdType);
guid->length (sizeof (size_t));
ACE_OS::memcpy (guid->get_buffer (),
serv_cxt->context_data.get_buffer (),
sizeof (size_t));
guid_out = guid;
}
catch (const CORBA::Exception&)
{
ACE_DEBUG ((LM_DEBUG,
"Invalid Service Context\n"));
}
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:39,代码来源:Scheduler.cpp
示例18: INTERNAL
void
ServerRequestInterceptor::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
// If no response is expected, then we're invoking the oneway
// shutdown operation. Don't bother displaying output a second
// time.
CORBA::Boolean response_expected =
ri->response_expected ();
if (!response_expected)
return;
PortableServer::POA_var poa;
try
{
poa = this->poa_current_->get_POA ();
}
catch (const PortableServer::Current::NoContext& ex)
{
ex._tao_print_exception ("ServerRequestInterceptor::receive_request");
throw CORBA::INTERNAL ();
}
PortableServer::POA_var parent_poa =
poa->the_parent ();
// Make sure there is more than one POA in the POA hierarchy since
// the servant should have been registered with a child POA, not the
// RootPOA.
ACE_ASSERT (!CORBA::is_nil (parent_poa.in ()));
PortableInterceptor::AdapterName_var name =
ri->adapter_name ();
ACE_DEBUG ((LM_INFO,
"POA Hierarchy:\n"
"==============\n"));
const CORBA::ULong len = name->length ();
// Make sure there is more than one AdapterName in the AdapterName
// sequence since the servant should have been registered with a
// child POA, not the RootPOA.
ACE_ASSERT (len > 1);
for (CORBA::ULong i = 0; i < len; ++i)
{
for (CORBA::ULong j = 0; j < i; ++j)
ACE_DEBUG ((LM_INFO, "\t"));
ACE_DEBUG ((LM_INFO,
"%C\n",
static_cast<char const*>(name[i])));
}
ACE_DEBUG ((LM_INFO,
"\n"
"==============\n"));
// Make sure the name of the RootPOA is the first in the AdapterName
// sequence.
ACE_ASSERT (ACE_OS::strcmp ("RootPOA", name[(CORBA::ULong) 0]) == 0);
CORBA::String_var orb_id = ri->orb_id ();
ACE_ASSERT (ACE_OS::strcmp (this->orb_id_.in (), orb_id.in ()) == 0);
CORBA::String_var server_id = ri->server_id ();
ACE_ASSERT (ACE_OS::strcmp (server_id.in (), "ORT_test_server") == 0);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:75,代码来源:ServerRequestInterceptor.cpp
示例19:
void
MIF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri)
{
CORBA::Short importance = 0;
Kokyu::Svc_Ctxt_DSRT_QoS sc_qos;
CORBA::String_var operation = ri->operation ();
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T): send_reply from \"%s\"\n",
ri->operation ()));
#endif
// Make the context to send the context to the target
IOP::ServiceContext sc;
sc.context_id = Server_Interceptor::SchedulingInfo;
CORBA::Policy_var sched_policy =
this->current_->scheduling_parameter();
RTScheduling::Current::IdType_var guid = this->current_->id ();
if (CORBA::is_nil (sched_policy.in ()))
{
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T): sched_policy nil. ",
"importance not set in sched params\n"));
#endif
importance = 0;
}
else
{
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T):sched_policy not nil. ",
"importance set in sched params\n"));
#endif
MIF_Scheduling::SchedulingParameterPolicy_var sched_param_policy =
MIF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy.in ());
MIF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value ();
importance = sched_param->importance;
//Fill the guid in the SC Qos struct
sc_qos.guid.length (guid->length ());
guid_copy (sc_qos.guid, guid.in ());
sc_qos.importance = importance;
CORBA::Any sc_qos_as_any;
sc_qos_as_any <<= sc_qos;
CORBA::OctetSeq_var cdtmp = codec_->encode (sc_qos_as_any);
sc.context_data = cdtmp.in ();
// Add this context to the service context list.
ri->add_reply_service_context (sc, 1);
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG, "(%t|%T):reply sc added\n"));
#endif
}
kokyu_dispatcher_->update_schedule (guid.in (),
Kokyu::BLOCK);
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG, "(%t|%T): send_reply interceptor done\n"));
#endif
}
开发者ID:chenbk85,项目名称:ACE,代码行数:71,代码来源:MIF_Scheduler.cpp
示例20: cdr
void
TAO_LB_ServerRequestInterceptor::receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
if (this->load_alert_.alerted ())
{
CORBA::String_var op = ri->operation ();
if (ACE_OS::strcmp (op.in (), "_get_loads") == 0 // LoadMonitor
|| ACE_OS::strcmp (op.in (), "disable_alert") == 0 // LoadAlert
|| ACE_OS::strcmp (op.in (), "enable_alert") == 0) // LoadAlert
return; // Do not redirect.
#if 0
try
{
IOP::ServiceContext_var service_context =
ri->get_request_service_context (CosLoadBalancing::LOAD_MANAGED);
/*
// Use TAO-specific "compiled marshaling" instead of
// standard interpretive marshaling via a CDR encapsulation
// Codec for efficiency reasons.
const char * buf =
reinterpret_cast<const char *> (service_context->context_data.get_buffer ());
TAO_InputCDR cdr (buf,
service_context->context_data.length ());
CORBA::Boolean byte_order;
if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
throw CORBA::BAD_PARAM ();
cdr.reset_byte_order (static_cast<int> (byte_order));
CORBA::Object_var object_group;
if (cdr >> object_group.out ())
throw PortableInterceptor::ForwardRequest (object_group.in (,
0));
else
throw CORBA::BAD_PARAM ();
*/
// A ServiceContext of the given ServiceId exists. This
// means that the target is load balanced. Force the client
// to try another profile since this location is currently
// overloaded.
throw CORBA::TRANSIENT ();
}
catch (const CORBA::BAD_PARAM& ex)
{
// No CosLoadBalancing::LB_GROUP_REF ServiceContext. This
// probably means that the target object is not
// LoadBalanced.
// There is a huge DoS attack vulnerability with this load
// shedding model. The model relies on the client behaving
// correctly. In particular, it relies on the client to
// send the forward object group reference in the
// ServiceContextList. Any "misbehaving" client can avoid
// that, in which case no load will ever be shed!
// Make sure we get a CORBA::BAD_PARAM for the right
// reason.
if (ex.minor () != (CORBA::OMGVMCID | 26))
throw;
}
#else
// Force the client to try another profile since this location
// is currently overloaded.
//
// NOTE: This applies to both load balanced and non-load
// balanced targets.
throw CORBA::TRANSIENT ();
#endif /* 0 */
}
}
开发者ID:CCJY,项目名称:ATCD,代码行数:77,代码来源:LB_ServerRequestInterceptor.cpp
注:本文中的portableinterceptor::ServerRequestInfo_ptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论