2 #include "ServerORBInitializer.h"
3 #include "ServerRequestInterceptor.h"
4 #include "ClientRequestInterceptor2.h"
5 #include "tao/PI/ORBInitInfo.h"
6 #include "tao/ORB_Core.h"
8 PortableInterceptor::SlotId slot_id
= 2093843221;
11 ServerORBInitializer::pre_init (
12 PortableInterceptor::ORBInitInfo_ptr
/* info */
18 ServerORBInitializer::post_init (
19 PortableInterceptor::ORBInitInfo_ptr info
)
21 CORBA::Object_var obj
=
22 info
->resolve_initial_references ("PICurrent");
24 PortableInterceptor::Current_var pi_current
=
25 PortableInterceptor::Current::_narrow (obj
.in ());
27 if (CORBA::is_nil (pi_current
.in ()))
30 "(%P|%t) ERROR: Could not resolve PICurrent object.\n"));
32 throw CORBA::INTERNAL ();
35 ::slot_id
= info
->allocate_slot_id ();
37 PortableInterceptor::ServerRequestInterceptor_ptr server_tmp
;
38 ACE_NEW_THROW_EX (server_tmp
,
39 ServerRequestInterceptor (::slot_id
,
42 CORBA::SystemException::_tao_minor_code (
45 CORBA::COMPLETED_NO
));
47 PortableInterceptor::ServerRequestInterceptor_var server_interceptor
=
50 info
->add_server_request_interceptor (server_interceptor
.in ());
52 PortableInterceptor::ClientRequestInterceptor_ptr client_tmp
;
53 ACE_NEW_THROW_EX (client_tmp
,
54 ClientRequestInterceptor2 (::slot_id
),
56 CORBA::SystemException::_tao_minor_code (
59 CORBA::COMPLETED_NO
));
61 PortableInterceptor::ClientRequestInterceptor_var client_interceptor
=
64 info
->add_client_request_interceptor (client_interceptor
.in ());
66 // Disable collocation -- TAO-specific!!!
68 // Collocation optimizations must be disabled since TAO doesn't
69 // implement interceptor support for THRU_POA collocated
70 // invocations yet, and we need to force a client request
71 // interceptor to be invoked in this server.
72 TAO_ORBInitInfo_var tao_info
=
73 TAO_ORBInitInfo::_narrow (info
);
75 tao_info
->orb_core ()->optimize_collocation_objects (0);