Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / examples / LoadBalancing / ORBInitializer.cpp
blob07824aa8bc2fc6f25fe3adff3ec05c558400551a
1 #include "ORBInitializer.h"
2 #include "ServerRequestInterceptor.h"
4 #include "orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.h"
6 #include "orbsvcs/CosLoadBalancingC.h"
7 #include "tao/ORB_Constants.h"
9 ORBInitializer::ORBInitializer (void)
10 : load_alert_ (),
11 interceptor_ (0)
15 void
16 ORBInitializer::pre_init (
17 PortableInterceptor::ORBInitInfo_ptr)
21 void
22 ORBInitializer::post_init (
23 PortableInterceptor::ORBInitInfo_ptr info)
26 ACE_NEW_THROW_EX (this->interceptor_,
27 ServerRequestInterceptor,
28 CORBA::NO_MEMORY (
29 CORBA::SystemException::_tao_minor_code (
30 TAO::VMCID,
31 ENOMEM),
32 CORBA::COMPLETED_NO));
34 PortableInterceptor::ServerRequestInterceptor_var sr_interceptor =
35 this->interceptor_;
37 info->add_server_request_interceptor (sr_interceptor.in ());
39 PortableInterceptor::ServerRequestInterceptor_ptr reject_interceptor;
40 ACE_NEW_THROW_EX (reject_interceptor,
41 TAO_LB_ServerRequestInterceptor (this->load_alert_),
42 CORBA::NO_MEMORY (
43 CORBA::SystemException::_tao_minor_code (
44 TAO::VMCID,
45 ENOMEM),
46 CORBA::COMPLETED_NO));
48 PortableInterceptor::ServerRequestInterceptor_var safe_reject_interceptor =
49 reject_interceptor;
51 info->add_server_request_interceptor (safe_reject_interceptor.in ());
55 TAO_LB_LoadAlert &
56 ORBInitializer::load_alert (void)
58 return this->load_alert_;
61 ServerRequestInterceptor *
62 ORBInitializer::interceptor (void) const
64 return this->interceptor_;