diff options
author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-20 09:46:10 +0000 |
---|---|---|
committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-20 09:46:10 +0000 |
commit | 02686f8d5108580e8a3d56bfe9b124405fdedd18 (patch) | |
tree | 0426ac218b7505e1c06dbf5ff8d2b10144d7ce75 /TAO | |
parent | b2334408ebeffc6686b1f976247926df8411caec (diff) | |
download | ATCD-02686f8d5108580e8a3d56bfe9b124405fdedd18.tar.gz |
Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
Diffstat (limited to 'TAO')
213 files changed, 5807 insertions, 2551 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d8a28c0a007..5364460d990 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,550 @@ +Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl> + + Merged changes from Remedy work branch. + + === start changelog === + + Thu Oct 20 08:42:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * On_Demand_Act_Direct_Coll: + * On_Demand_Act_Direct_Coll/Collocated_Test.cpp: + * On_Demand_Act_Direct_Coll/Servant_Activator.cpp: + * On_Demand_Act_Direct_Coll/test_i.cpp: + * On_Demand_Act_Direct_Coll/Server_Task.h: + * On_Demand_Act_Direct_Coll/run_test.pl: + * On_Demand_Act_Direct_Coll/test_i.h: + * On_Demand_Act_Direct_Coll/Client_Task.cpp: + * On_Demand_Act_Direct_Coll/Server_Task.cpp: + * On_Demand_Act_Direct_Coll/Servant_Activator.h: + * On_Demand_Act_Direct_Coll/Client_Task.h: + * On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc: + * On_Demand_Act_Direct_Coll/test.idl: + Test with Servant Activator and thru_poa- and direct collocation. + + * bin/tao_orb_tests.lst + Added On_Demand_Act_Direct_Coll test. + + + Wed Oct 19 14:15:57 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * docs/tutorials/Quoter/RTCORBA/Broker.cpp: + * docs/tutorials/Quoter/RTCORBA/docs/distributor.html: + Fixed typos. + + * orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h: + Fixed typo. + + * orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp: + ++x instead of x++; + + Tue Oct 18 13:47:54 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svh.cpp: + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Reverted last changes. Need a more robust implementation to + fix re-entrancy + + Tue Oct 18 11:35:58 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_exception/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp: + Layout changes to the generated code + + Tue Oct 18 10:51:21 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svh.cpp: + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Using recursive mutexes instead of normal mutexes. + + Tue Oct 18 10:39:23 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/context_svs.cpp: + Fixed a minor indentation issue. + + Tue Oct 18 10:03:32 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * TAO_IDL/be/be_visitor_component/servant_svs.cpp: + Using the container_ variable in a thread safe way. + + Tue Oct 18 07:01:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc: + Changes for duplicate project names. + + Mon Oct 17 13:08:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_DerivedIF: + * tests/Collocated_DerivedIF/Client_Task.h: + * tests/Collocated_DerivedIF/Client_Task.cpp: + * tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc: + * tests/Collocated_DerivedIF/Collocated_Test.cpp: + * tests/Collocated_DerivedIF/Hello.h: + * tests/Collocated_DerivedIF/Hello.cpp: + * tests/Collocated_DerivedIF/Server_Task.h: + * tests/Collocated_DerivedIF/Server_Task.cpp: + * tests/Collocated_DerivedIF/Test.idl: + * tests/Collocated_DerivedIFl/run_test.pl: + * tests/Collocated_DerivedIFl/README: + Test for -ORBCollocationStrategy direct and interface inheritance + + * tests/Collocated_Best/README: + Add ID + + Mon Oct 17 12:33:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * docs/Options.html + Added new define TAO_DEFAULT_COLLOCATION_STRATEGY . + + Mon Oct 17 11:41:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * docs/Options.html + Add new ORBCollocationStrategy best . + + Thu Oct 13 12:57:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be_include/be_valuetype.h: + * TAO_IDL/be/be_valuetype.cpp: + Removed gen_skel_helper from here, not used at all + + * orbsvcs/tests/Notify/lib/Options_Parser.cpp: + Fixed compile error with gcc 4.6 + + Thu Oct 13 12:14:00 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_si.cpp: + static_cast seems to be required, not sure why, reverting this part + to get our branch build green again + + Thu Oct 13 11:15:06 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/AnyTypeCode/Any_Impl.cpp: + Layout changes + + * tao/LocalObject.cpp: + * tao/Object.cpp: + Log an error before throwing a NO_IMPLEMENT system exception + + Thu Oct 13 07:15:34 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_si.cpp: + Further reduction of code being generated in case of interface + inheritance + + Thu Oct 13 06:46:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + Fixed problem with num_args that still was generated for arguments + + Wed Oct 12 14:14:32 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_si.cpp: + Changed indentation and removed not needed static cast in the + generated code + + Wed Oct 12 12:06:33 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + * tests/Collocated_NoColl: + * tests/Collocated_NoColl/Client_Task.h: + * tests/Collocated_NoColl/Client_Task.cpp: + * tests/Collocated_NoColl/Collocated_NoColl.mpc: + * tests/Collocated_NoColl/Collocated_Test.cpp: + * tests/Collocated_NoColl/Hello.h: + * tests/Collocated_NoColl/Hello.cpp: + * tests/Collocated_NoColl/Server_Task.h: + * tests/Collocated_NoColl/Server_Task.cpp: + * tests/Collocated_NoColl/Test.idl: + * tests/Collocated_NoColl/run_test.pl: + Test for -ORBCollocation NO + + + Wed Oct 12 12:02:04 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.cpp: + Print the collocation strategy that we have determined + + * tests/Hello/run_test.pl: + Added -cdebug that enables ORBDebugLevel 10 for the client + + Wed Oct 12 10:09:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp: + * TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp: + * tao/Abstract_Servant_Base.h: + * tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp: + * tao/PortableServer/Operation_Table.h: + Removed the num_args argument for the direct collocation skeleton + functions because it was not used at all + + Wed Oct 12 09:55:38 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.cpp: + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + unchecked_narrow method was available with and without repository_id + argument but that wasn't used at all. merged both methods into one + and updated tao_idl code generation to not generate the repository_id + anymore + + Wed Oct 12 09:01:19 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.cpp: + * tao/PortableServer/PolicyS.cpp: + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + Removed the collocation opportunity from the narrow calls, the + boolean collocated only means whether the servant is collocated or + not and shouldn't include the fact whether we have a collocation + opportunity or not + + Tue Oct 11 17:38:06 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp: + Also check the string that returned + + Tue Oct 11 10:53:17 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/Object_T.cpp: + Don't use collocation opportunity, just determine whether the + object is collocated or not. If this doesn't break any tests, we + need to do some more cleanup here + + Tue Oct 11 10:41:02 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/CORBANAME_Parser.cpp: + * tao/Remote_Object_Proxy_Broker.cpp: + Enable through poa collocation by default + + Tue Oct 11 07:17:47 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Layout changes and just always generate the orb optimize flags + + Mon Oct 10 17:43:50 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/IIOP_Connector.cpp: + * tao/Invocation_Adapter.h: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Moved collocation_strategy from the orb core to the invocation adapter + + * tests/Collocated_ThruP_Sp/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp/README: + * tests/Collocated_ThruP_Sp/Server_Task.cpp: + * tests/Collocated_ThruP_Sp/run_test.pl: + * tests/Collocated_ThruP_Sp_Gd/README: + * tests/Collocated_ThruP_Sp_Gd/run_test.pl: + Add -debug to the script, layout changes, missing Id + + Fri Oct 7 10:54:09 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/ORB_Core.cpp: + Tweaked collocation strategy a little bit more, for direct we need + a servant, not for poa. If we are not collocated, we just go remote and + not give an exception + + Fri Oct 7 09:17:36 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Layout change to generated code + + * tao/Invocation_Adapter.cpp: + Removed the check that servant != 0 before being able to invoke + collocated, collocation opportunities test shows a case where this + happens + + * tao/ORB_Core.cpp: + Added logging before we throw an exception related to collocation + mis configuration. If we are collocated with best opportunity without + any opportunity we default to remote instead of having an exception. + Through poa seems possible without a servant pointer + + Thu Oct 6 09:34:57 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * tao/DynamicInterface/DII_Invocation_Adapter.cpp: + Set collocation_opportunity to TAO_CO_THRU_POA_STRATEGY instead of 0. + + Thu Oct 6 08:56:57 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc: + * orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc: + * tests/Oneway_Buffering/Oneway_Buffering.mpc: + * tests/Policies/Policies.mpc: + requires for corba_messaging is already pulled in through the + base projects + + Wed Oct 5 18:49:30 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be/be_visitor_root/root_ch.cpp: + * TAO_IDL/be_include/be_global.h: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be_include/be_visitor_root/root_ch.h: + Even more cleanup of old stuff + + Wed Oct 5 18:42:43 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_home.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp: + * TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp: + More cleanup + + * TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h: + * TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h: + Removed these files. + + Wed Oct 5 18:34:21 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_home.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be_include/be_interface.h: + Cleanup of very old stuff + + * TAO_IDL/be/be_visitor_operation/ami_cs.cpp: + Fixed cpb + + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + Updated for changes below + + * tests/CSD_Collocation/svc.conf.csd: + Removed deprecated arguments + + Wed Oct 5 13:01:20 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * tests/Collocated_Best/README + * tests/Collocated_ThruP_Sp/README + * tests/Collocated_ThruP_Sp_Gd/README + * tests/Bug_2241_Regression/README + Add README's + + * bin/tao_orb_tests.lst + Added Collocated_ThruP_Sp_Gd test. + + Wed Oct 5 12:41:20 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_operation/operation.cpp: + * tao/PolicyC.cpp: + * tao/Collocation_Strategy.h: + * tao/PortableServer/PolicyS.cpp: + Change define TAO_CO_DIRECT_POA,remove POA + + * tao/DynamicInterface/DII_Invocation_Adapter.h: + * tao/DynamicInterface/DII_Invocation_Adapter.cpp: + * tao/Messaging/Asynch_Invocation_Adapter.h: + * tao/Messaging/Asynch_Invocation_Adapter.cpp: + * tao/Valuetype/AbstractBase_Invocation_Adapter.h: + * tao/Valuetype/AbstractBase_Invocation_Adapter.cpp: + Change proxybroker for collocation opertunities + + * tao/ORB_Core.cpp: + * tao/Invocation_Adapter.cpp: + Extended collocation_strategy with opertunities + Handling of BEST strategy and checking other strategies. + + * tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: + + + + Wed Oct 5 08:35:20 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_component.cpp: + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_interface.cpp: + * TAO_IDL/be/be_visitor_interface/amh_ss.cpp: + * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ci.cpp: + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_sh.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_operation/ami_cs.cpp: + * TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp: + * TAO_IDL/be/be_visitor_operation/operation.cpp: + * TAO_IDL/be/be_visitor_root/root_ch.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp: + * TAO_IDL/be_include/be_component.h: + * TAO_IDL/be_include/be_interface.h: + * TAO_IDL/be_include/be_visitor_interface.h: + * tao/Abstract_Servant_Base.h: + * tao/Collocated_Invocation.h: + * tao/Collocated_Invocation.cpp: + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.h: + * tao/Invocation_Adapter.inl: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + * tao/Object.h: + * tao/Object.cpp: + * tao/Object_T.h: + * tao/Object_T.cpp: + * tao/PolicyC.h: + * tao/PolicyC.inl: + * tao/PolicyC.cpp: + * tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h: + * tao/PortableServer/PolicyS.h: + * tao/PortableServer/PolicyS.cpp: + * tao/PortableServer/Servant_Base.h: + * tao/PortableServer/Servant_Base.cpp: + * tao/tao.mpc: + Rough reimplementatin of handling of collocated call. A pre condition + for using collocation is having a servant pointer. The core of TAO + also couldn't detect whether through poa collocation is requested + without having -Gp being enabled. The collocated proxy broker (cpb) + was only used for direct collocation, but didn't contain any interface + specific code. TAO_IDL now generated a collocation opportunity to + indicate which support it did generate, when the core than has + a servant pointer it can determine which opportunities it has an + what is requested. + + As side effect we get smaller generated code, less complexity, and + better performance + + This has to be finished but committing it right now. + + * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp: + * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp: + * TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h: + * TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h: + * tao/Collocation_Proxy_Broker.h: + * tao/Collocation_Proxy_Broker.cpp: + Removed these files. + + Wed Oct 5 07:15:46 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * tao/PortableServer/Collocated_Object_Proxy_Broker.cpp: + Add prefix TAO_COLLOCATION_ to Collocated strategy Thru_POA + + Tue Oct 4 16:36:46 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Clean up debug text + + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Change Exception for collocated errors. + Add prefix TAO_COLLOCATION_ to Collocated strategies DIrect, Best and Thru_POA + Add TAO_DEFAULT_COLLOCATION_STRATEGY + + * tao/orbconf.h: + Add TAO_DEFAULT_COLLOCATION_STRATEGY + + * tests/Bug_2241_Regression/run_test.pl: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc: + + * tests/Collocated_ThruP_Sp_Gd: + * tests/Collocated_ThruP_Sp_Gd/Client_Task.h: + * tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp: + * tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc: + * tests/Collocated_ThruP_Sp_Gd/Hello.h: + * tests/Collocated_ThruP_Sp_Gd/Hello.cpp: + * tests/Collocated_ThruP_Sp_Gd/Server_Task.h: + * tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp: + * tests/Collocated_ThruP_Sp_Gd/Test.idl: + * tests/Collocated_ThruP_Sp_Gd/run_test.pl: + New test for combination Sp and Gd + + Mon Oct 3 15:33:35 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + Change dead to 0 for Collocation_Proxy_Broker + + * tao/Collocation_Strategy.h: + * tao/Invocation_Adapter.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.cpp: + Add exceptions for situations if not used -Gp or used -Sp idl flags and + ORBCollocationStrategies Direct and Thru_Poa. Add strategie BEST. + To do: add prefix COLLOCATION_. + + * tests/Bug_2241_Regression/Client_Task.cpp: + * tests/Bug_2241_Regression/Hello.cpp: + * tests/Bug_2241_Regression/run_test.pl: + Catch expected exceptions. + + * tests/Collocated_Best: + * tests/Collocated_Best/Collocated_Best_Direct: + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc: + * tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Hello.h: + * tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_Direct/Test.idl: + * tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: + + * tests/Collocated_Best/Collocated_Best_NoColl: + + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc: + * tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_NoColl/Test.idl: + * tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl: + + * tests/Collocated_Best/Collocated_Best_ThuP: + + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc: + * tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Hello.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h: + * tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp: + * tests/Collocated_Best/Collocated_Best_ThuP/Test.idl: + * tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl: + + * tests/Collocated_ThruP_Sp: + + * tests/Collocated_ThruP_Sp/Client_Task.h: + * tests/Collocated_ThruP_Sp/Client_Task.cpp: + * tests/Collocated_ThruP_Sp/Collocated_Test.cpp: + * tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc: + * tests/Collocated_ThruP_Sp/Hello.h: + * tests/Collocated_ThruP_Sp/Hello.cpp: + * tests/Collocated_ThruP_Sp/Server_Task.h: + * tests/Collocated_ThruP_Sp/Server_Task.cpp: + * tests/Collocated_ThruP_Sp/Test.idl: + * tests/Collocated_ThruP_Sp/run_test.pl: + tests for COLLOCATION_DIRECT. To do: add readme + + === end changelog === + Mon Oct 10 08:48:51 CEST 2011 Johnny Willemsen <jwillemsen@remedy.nl> * TAO version 2.0.5 released. @@ -1,6 +1,12 @@ -USER VISIBLE CHANGES BETWEEN TAO-2.0.5 and TAO-2.0.6 +USER VISIBLE CHANGES BETWEEN TAO-2.0.5 and TAO-2.1.0 ==================================================== + . Added new define TAO_DEFAULT_COLLOCATION_STRATEGY (default = thru_poa) which is used as + -ORBCollocationStrategy isn't specified. + + . Added new -ORBCollocationStrategy best. TAO tries to perform the best possible + collocation, first direct if possible, then through_poa if possible else no collocation. + USER VISIBLE CHANGES BETWEEN TAO-2.0.4 and TAO-2.0.5 ==================================================== diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index b811ca7a72f..39003bec0d6 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -2669,8 +2669,6 @@ TAO_CodeGen::gen_skel_hdr_includes (void) } this->gen_standard_include (this->server_header_, - "tao/Collocation_Proxy_Broker.h"); - this->gen_standard_include (this->server_header_, "tao/PortableServer/PortableServer.h"); this->gen_standard_include (this->server_header_, "tao/PortableServer/Servant_Base.h"); diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp index 9d2cd33ab31..68a612fb86f 100644 --- a/TAO/TAO_IDL/be/be_component.cpp +++ b/TAO/TAO_IDL/be/be_component.cpp @@ -369,19 +369,6 @@ be_component::gen_is_a_ancestors (TAO_OutStream *os) } void -be_component::gen_parent_collocation (TAO_OutStream *os) -{ - AST_Component *base = this->base_component (); - - if (base != 0) - { - *os << be_nl - << "this->" << base->flat_name () - << "_setup_collocation" << " ();"; - } -} - -void be_component::mirror_scan (AST_PortType *pt) { AST_Uses *u = 0; diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp index cecee18c8cb..6c8aa51a9cd 100644 --- a/TAO/TAO_IDL/be/be_home.cpp +++ b/TAO/TAO_IDL/be/be_home.cpp @@ -133,42 +133,12 @@ be_home::destroy (void) delete [] this->relative_skel_name_; this->relative_skel_name_ = 0; - delete [] this->base_proxy_impl_name_; - this->base_proxy_impl_name_ = 0; - - delete [] this->remote_proxy_impl_name_; - this->remote_proxy_impl_name_ = 0; - delete [] this->direct_proxy_impl_name_; this->direct_proxy_impl_name_ = 0; - delete [] this->full_base_proxy_impl_name_; - this->full_base_proxy_impl_name_ = 0; - - delete [] this->full_remote_proxy_impl_name_; - this->full_remote_proxy_impl_name_ = 0; - delete [] this->full_direct_proxy_impl_name_; this->full_direct_proxy_impl_name_ = 0; - delete [] this->base_proxy_broker_; - this->base_proxy_broker_ = 0; - - delete [] this->remote_proxy_broker_; - this->remote_proxy_broker_ = 0; - - delete [] this->strategized_proxy_broker_; - this->strategized_proxy_broker_ = 0; - - delete [] this->full_base_proxy_broker_name_; - this->full_base_proxy_broker_name_ = 0; - - delete [] this->full_remote_proxy_broker_name_; - this->full_remote_proxy_broker_name_ = 0; - - delete [] this->full_strategized_proxy_broker_name_; - this->full_strategized_proxy_broker_name_ = 0; - delete [] this->client_scope_; this->client_scope_ = 0; diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 81ec9046965..dca37dd5cf7 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -50,15 +50,11 @@ const char *be_interface::suffix_table_[] = { "_Proxy_Impl", - "_Proxy_Broker" }; const char *be_interface::tag_table_[] = { - "_ThruPOA", "_Direct", - "_Remote", - "_Strategized", "_TAO_" }; @@ -88,18 +84,8 @@ be_interface::be_interface (UTL_ScopedName *n, n), be_type (AST_Decl::NT_interface, n), - base_proxy_impl_name_ (0), - remote_proxy_impl_name_ (0), direct_proxy_impl_name_ (0), - full_base_proxy_impl_name_ (0), - full_remote_proxy_impl_name_ (0), full_direct_proxy_impl_name_ (0), - base_proxy_broker_ (0), - remote_proxy_broker_ (0), - strategized_proxy_broker_ (0), - full_base_proxy_broker_name_ (0), - full_remote_proxy_broker_name_ (0), - full_strategized_proxy_broker_name_ (0), client_scope_ (0), flat_client_scope_ (0), server_scope_ (0), @@ -365,13 +351,13 @@ be_interface::compute_coll_names (int type, // in the loop. j.next (); - // We add the POA_ preffix only if the first component is not + // We add the POA_ prefix only if the first component is not // the global scope... if (ACE_OS::strcmp (item, "") != 0) { if (!j.is_done ()) { - // We only add the POA_ preffix if there are more than + // We only add the POA_ prefix if there are more than // two components in the name, in other words, if the // class is inside some scope. if (!poa_added) @@ -669,6 +655,7 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) // Generate the constructor from stub and servant. if (!this->is_local ()) { + bool const abstract = this->is_abstract (); *os << be_nl_2 << "ACE_INLINE" << be_nl; *os << this->name () << "::" @@ -677,7 +664,8 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) << "TAO_Stub *objref," << be_nl << "::CORBA::Boolean _tao_collocated," << be_nl << "TAO_Abstract_ServantBase *servant," << be_nl - << "TAO_ORB_Core *oc)" << be_uidt_nl + << "TAO_ORB_Core *" << (abstract ? "" : "oc") << ")" + << be_uidt_nl << ": "; bool the_check = @@ -740,29 +728,7 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) *os << "::CORBA::Object (objref, _tao_collocated, servant, oc)"; } - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "," << be_nl - << "the" << this->base_proxy_broker_name () << "_ (0)" - << be_uidt << be_uidt; - } - - *os << be_nl << "{" << be_idt_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "this->" << this->flat_name () - << "_setup_collocation ();"; - } - - if (this->is_abstract ()) - { - *os << be_nl - << "ACE_UNUSED_ARG (oc);"; - } - - *os << be_uidt_nl - << "}"; + *os << be_uidt << be_uidt_nl << "{" << be_nl << "}"; } } @@ -867,8 +833,7 @@ private: }; TAO_IDL_Gen_OpTable_Worker::TAO_IDL_Gen_OpTable_Worker ( - const char *skeleton_name - ) + const char *skeleton_name) : skeleton_name_ (skeleton_name) { } @@ -1286,7 +1251,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, const char *full_skeleton_name, TAO_OutStream *os) { - int lookup_strategy = + int const lookup_strategy = be_global->lookup_strategy (); if (lookup_strategy == BE_GlobalData::TAO_DYNAMIC_HASH) @@ -1326,7 +1291,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; } else if (d->node_type () == AST_Decl::NT_attr) { @@ -1355,7 +1320,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; if (!attr->readonly ()) { @@ -1377,7 +1342,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, *os << "}," << be_nl; - derived_interface->skel_count_++; + ++derived_interface->skel_count_; } } } @@ -1515,20 +1480,17 @@ be_interface::gen_collocated_skel_body (be_interface *derived, << "ACE_INLINE void" << be_nl << derived->full_direct_proxy_impl_name () << "::" << prefix << d->local_name () << " (" - << be_idt << be_idt_nl + << be_idt_nl << "TAO_Abstract_ServantBase *servant," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args)" << be_uidt_nl; + << "TAO::Argument ** args)" << be_uidt_nl; - *os << be_uidt_nl - << "{" << be_idt_nl + *os << "{" << be_idt_nl << ancestor->full_direct_proxy_impl_name () << "::" << prefix << d->local_name () << " (" - << be_idt << be_idt_nl + << be_idt_nl << "servant," << be_nl - << "args," << be_nl - << "num_args);" << be_uidt - << be_uidt << be_uidt_nl + << "args);" << be_uidt + << be_uidt_nl << "}"<< be_nl; } @@ -1592,7 +1554,6 @@ be_interface::traverse_inheritance_graph ( this->insert_queue.reset (); this->del_queue.reset (); - // Insert ourselves in the queue. if (insert_queue.enqueue_tail (this) == -1) { @@ -2198,7 +2159,6 @@ be_interface::gen_skel_helper (be_interface *derived, // attributes defined by "ancestor", become methods on the derived // class which call the corresponding method of the base class by // doing the proper casting. - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); !si.is_done (); si.next ()) @@ -2241,14 +2201,14 @@ be_interface::gen_skel_helper (be_interface *derived, << "void" << be_nl << derived->full_skel_name () << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "TAO_ServerRequest & server_request," << be_nl << "void * servant_upcall," << be_nl - << "void * servant)" << be_uidt + << "void * servant)" << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor->full_skel_name () + *os << ancestor->full_skel_name () << " * const impl =" << be_idt_nl << "static_cast<" << derived->full_skel_name () @@ -2256,11 +2216,11 @@ be_interface::gen_skel_helper (be_interface *derived, *os << ancestor->full_skel_name () << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "server_request," << be_nl << "servant_upcall," << be_nl << "impl);" << be_uidt - << be_uidt << be_uidt_nl + << be_uidt_nl << "}"; } } @@ -2300,7 +2260,7 @@ be_interface::gen_skel_helper (be_interface *derived, << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor->full_skel_name () + *os << ancestor->full_skel_name () << " * const impl = static_cast<" << derived->full_skel_name () << " *> (servant);" << be_nl; @@ -2406,8 +2366,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, *os << "static void" << be_nl << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; } else if (d->node_type () == AST_Decl::NT_attr) { @@ -2422,8 +2381,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, *os << "static void" << be_nl << "_get_" << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; if (!attr->readonly ()) { @@ -2435,8 +2393,7 @@ be_interface::gen_colloc_op_decl_helper (be_interface *derived, << "_set_" << d->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" << be_uidt_nl; } } } @@ -2728,42 +2685,12 @@ be_interface::destroy (void) delete [] this->relative_skel_name_; this->relative_skel_name_ = 0; - delete [] this->base_proxy_impl_name_; - this->base_proxy_impl_name_ = 0; - - delete [] this->remote_proxy_impl_name_; - this->remote_proxy_impl_name_ = 0; - delete [] this->direct_proxy_impl_name_; this->direct_proxy_impl_name_ = 0; - delete [] this->full_base_proxy_impl_name_; - this->full_base_proxy_impl_name_ = 0; - - delete [] this->full_remote_proxy_impl_name_; - this->full_remote_proxy_impl_name_ = 0; - delete [] this->full_direct_proxy_impl_name_; this->full_direct_proxy_impl_name_ = 0; - delete [] this->base_proxy_broker_; - this->base_proxy_broker_ = 0; - - delete [] this->remote_proxy_broker_; - this->remote_proxy_broker_ = 0; - - delete [] this->strategized_proxy_broker_; - this->strategized_proxy_broker_ = 0; - - delete [] this->full_base_proxy_broker_name_; - this->full_base_proxy_broker_name_ = 0; - - delete [] this->full_remote_proxy_broker_name_; - this->full_remote_proxy_broker_name_ = 0; - - delete [] this->full_strategized_proxy_broker_name_; - this->full_strategized_proxy_broker_name_ = 0; - delete [] this->client_scope_; this->client_scope_ = 0; @@ -3043,34 +2970,6 @@ be_interface::gen_is_a_ancestors (TAO_OutStream *os) return 0; } -void -be_interface::gen_parent_collocation (TAO_OutStream *os) -{ - long n_parents = this->n_inherits (); - bool has_parent = false; - AST_Type **parents = this->inherits (); - - if (n_parents > 0) - { - for (long i = 0; i < n_parents; ++i) - { - be_interface *inherited = - be_interface::narrow_from_decl (parents[i]); - - if (!has_parent) - { - *os << be_nl; - } - - has_parent = true; - - *os << be_nl - << "this->" << inherited->flat_name () - << "_setup_collocation" << " ();"; - } - } -} - // ================================================================= class Facet_Op_Attr_Helper @@ -3379,84 +3278,6 @@ be_interface::is_ami4ccm_rh (bool val) } const char * -be_interface::base_proxy_impl_name (void) -{ - if (this->base_proxy_impl_name_ == 0) - { - this->base_proxy_impl_name_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_IMPL]); - } - - return this->base_proxy_impl_name_; -} - -const char * -be_interface::full_base_proxy_impl_name (void) -{ - if (this->full_base_proxy_impl_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = - this->base_proxy_impl_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_base_proxy_impl_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_base_proxy_impl_name_, - scope); - ACE_OS::strcat (this->full_base_proxy_impl_name_, - base_name); - } - - return this->full_base_proxy_impl_name_; -} - -const char * -be_interface::remote_proxy_impl_name (void) -{ - if (this->remote_proxy_impl_name_ == 0) - { - this->remote_proxy_impl_name_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_IMPL], - this->tag_table_[REMOTE]); - } - - return this->remote_proxy_impl_name_; -} - -const char * -be_interface::full_remote_proxy_impl_name (void) -{ - if (this->full_remote_proxy_impl_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->remote_proxy_impl_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_remote_proxy_impl_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_remote_proxy_impl_name_, - scope); - ACE_OS::strcat (this->full_remote_proxy_impl_name_, - base_name); - } - - return this->full_remote_proxy_impl_name_; -} - -const char * be_interface::direct_proxy_impl_name (void) { if (this->direct_proxy_impl_name_ == 0) @@ -3498,125 +3319,6 @@ be_interface::full_direct_proxy_impl_name (void) const char * -be_interface::base_proxy_broker_name (void) -{ - if (this->base_proxy_broker_ == 0) - { - this->base_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER]); - } - - return this->base_proxy_broker_; -} - -const char * -be_interface::full_base_proxy_broker_name (void) -{ - if (this->full_base_proxy_broker_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->base_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_base_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_base_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_base_proxy_broker_name_, - base_name); - } - - return this->full_base_proxy_broker_name_; -} - - -const char * -be_interface::remote_proxy_broker_name (void) -{ - if (this->remote_proxy_broker_ == 0) - { - this->remote_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER], - this->tag_table_[REMOTE]); - } - - return this->remote_proxy_broker_; -} - -const char * -be_interface::full_remote_proxy_broker_name (void) -{ - if (this->full_remote_proxy_broker_name_ == 0) - { - const char *scope = this->client_enclosing_scope (); - const char *base_name = this->remote_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_remote_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_remote_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_remote_proxy_broker_name_, - base_name); - } - - return this->full_remote_proxy_broker_name_; -} - - -const char * -be_interface::strategized_proxy_broker_name (void) -{ - if (this->strategized_proxy_broker_ == 0) - { - this->strategized_proxy_broker_ = - this->create_with_prefix_suffix ( - this->tag_table_[GC_PREFIX], - this->local_name (), - this->suffix_table_[PROXY_BROKER], - this->tag_table_[STRATEGIZED]); - } - - return this->strategized_proxy_broker_; -} - -const char * -be_interface::full_strategized_proxy_broker_name (void) -{ - if (this->full_strategized_proxy_broker_name_ == 0) - { - const char *scope = this->server_enclosing_scope (); - const char *base_name = - this->strategized_proxy_broker_name (); - size_t length = - ACE_OS::strlen (scope) + ACE_OS::strlen (base_name); - - ACE_NEW_RETURN (this->full_strategized_proxy_broker_name_, - char[length + 1], - 0); - - ACE_OS::strcpy (this->full_strategized_proxy_broker_name_, - scope); - ACE_OS::strcat (this->full_strategized_proxy_broker_name_, - base_name); - } - - return this->full_strategized_proxy_broker_name_; -} - -const char * be_interface::client_enclosing_scope (void) { if (this->client_scope_ == 0) diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index badb282a429..fc16fb8e30d 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -779,94 +779,5 @@ be_valuetype::abstract_supports_helper (be_interface *, return 0; } -int -be_valuetype::gen_skel_helper (be_interface *concrete, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (concrete == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract ()) - { - return 0; - } - - // Else generate code that does the cast to the appropriate type. - - if (ancestor->nmembers () > 0) - { - // If there are elements in ancestor scope i.e., any operations and - // attributes defined by "ancestor", become methods on the derived class - // which call the corresponding method of the base class by doing the - // proper casting. - - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - - if (d->node_type () == AST_Decl::NT_op) - { - // Start from current indentation level. - os->indent (); - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR) - { - // Generate the static method corresponding to this method. - *os << "static void " << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req, " << be_nl - << "void *obj," << be_nl - << "void *context" << be_uidt_nl - << ");" << be_uidt << "\n\n"; - } - else - { // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE void " - << concrete->full_skel_name () << "::" - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *context" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - *os << ancestor->full_skel_name () - << "_ptr impl = (" - << concrete->full_skel_name () - << "_ptr) obj;" << be_nl; - *os << ancestor->full_skel_name () - << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "req," << be_nl - << "(" << ancestor->full_skel_name () - << "_ptr) impl," << be_nl - << "context" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}\n"; - } - } - } // End of scope iterator. - } - - return 0; -} - IMPL_NARROW_FROM_DECL (be_valuetype) IMPL_NARROW_FROM_SCOPE (be_valuetype) diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp index f5f2749fe00..418165944e4 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp @@ -488,8 +488,8 @@ be_visitor_context_svs::gen_uses_multiplex ( << "retv = iter->second;" << be_nl << "n = this->ciao_uses_" << port_name << "_.erase (key);" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_uidt; + << "}" << be_uidt << be_uidt_nl + << "}"; os_ << be_nl_2 << "if (n != 1UL)" << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp index cd9943a1671..649c69a3d78 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp @@ -320,14 +320,20 @@ be_visitor_servant_svs::visit_provides (be_provides *node) << "this)," << be_uidt_nl << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl << "::CIAO::Port_Activator_var pa = tmp;" << be_nl_2 + << "::CIAO::Container_var cnt_safe =" << be_idt_nl + << "::CIAO::Container::_duplicate (" + << "this->container_.in ());" << be_uidt_nl << be_nl + << "if (::CORBA::is_nil (cnt_safe.in ()))" << be_idt_nl + << "{" << be_idt_nl << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl + << "}" << be_uidt_nl << be_nl << "::CIAO::Servant_Activator_var sa =" << be_idt_nl - << "this->container_->ports_servant_activator ();" + << "cnt_safe->ports_servant_activator ();" << be_uidt_nl << be_nl << "if (sa->register_port_activator (pa.in ()))" << be_idt_nl << "{" << be_idt_nl << "::CORBA::Object_var obj =" << be_idt_nl - << "this->container_->generate_reference (" << be_idt_nl + << "cnt_safe->generate_reference (" << be_idt_nl << "obj_id.c_str ()," << be_nl << "\"" << obj->repoID () << "\"," << be_nl << "::CIAO::Container_Types::FACET_CONSUMER_t);" diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp index a1cecbb2468..f19f1a6d63d 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -144,53 +144,53 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert_copy (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion operator." *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer operator. *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer operator. *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -198,8 +198,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; be_util::gen_nested_namespace_end (os, module); @@ -219,8 +219,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy (" << be_idt << be_idt_nl @@ -235,8 +235,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -251,13 +251,13 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer operator. @@ -273,8 +273,8 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 6326664887f..76d01092d19 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -79,10 +79,6 @@ #include "be_visitor_interface/smart_proxy_ch.cpp" #include "be_visitor_interface/smart_proxy_cs.cpp" -// Proxy Brokers -#include "be_visitor_interface/strategized_proxy_broker_sh.cpp" -#include "be_visitor_interface/strategized_proxy_broker_ss.cpp" - // Proxy Impls #include "be_visitor_interface/direct_proxy_impl_sh.cpp" #include "be_visitor_interface/direct_proxy_impl_ss.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp index 5a81582e537..11b3910effa 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp @@ -12,8 +12,7 @@ //============================================================================= be_visitor_amh_interface_si::be_visitor_amh_interface_si ( - be_visitor_context *ctx - ) + be_visitor_context *ctx) : be_visitor_interface_si (ctx) { } @@ -40,9 +39,7 @@ be_visitor_amh_interface_si::visit_interface (be_interface *node) int status = node->traverse_inheritance_graph ( - be_visitor_amh_interface_si::gen_skel_helper, - os - ); + be_visitor_amh_interface_si::gen_skel_helper, os); if (status == -1) { @@ -141,8 +138,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; *os << ancestor_amh_name << "* const impl = static_cast<" @@ -150,11 +147,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << " *> (obj);" << be_nl; *os << ancestor_amh_name << "::" << d->local_name () - << "_skel (" << be_idt << be_idt_nl + << "_skel (" << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt_nl << "}"; } else if (nt == AST_Decl::NT_attr) @@ -177,11 +174,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor_amh_name + *os << ancestor_amh_name << "* const impl = static_cast<" << derived_amh_name << " *> (obj);" << be_nl; @@ -191,8 +188,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt << be_uidt_nl << "}"; if (!attr->readonly ()) @@ -209,11 +206,11 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl << "void * context," << be_nl - << "void * obj" << be_uidt_nl - << ")" << be_uidt_nl + << "void * obj)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl; - *os << ancestor_amh_name + *os << ancestor_amh_name << "* const impl = static_cast<" << derived_amh_name << " *> (obj);" << be_nl; @@ -223,8 +220,8 @@ be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, << "_skel (" << be_idt << be_idt_nl << "req," << be_nl << "context," << be_nl - << "impl" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "impl);" << be_uidt + << be_uidt << be_uidt_nl << "}"; } } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp index 645b5640710..2822f200472 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -97,21 +97,9 @@ be_visitor_amh_interface_ss::this_method (be_interface *node) { *os << "TAO::AbstractBase_Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ("; } - *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl; + *os << "obj.in ());" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else - { - *os << "0" << be_uidt_nl; - } - - *os << ");" << be_uidt << be_uidt << be_uidt_nl + *os << be_uidt << be_uidt_nl << "}"; } @@ -221,14 +209,12 @@ public: be_interface *derived); }; -TAO_IDL_Copy_Ctor_Worker:: -TAO_IDL_Copy_Ctor_Worker (void) +TAO_IDL_Copy_Ctor_Worker::TAO_IDL_Copy_Ctor_Worker (void) { } int -TAO_IDL_Copy_Ctor_Worker:: -emit (be_interface *derived, +TAO_IDL_Copy_Ctor_Worker::emit (be_interface *derived, TAO_OutStream *os, be_interface *base) { @@ -278,12 +264,11 @@ be_visitor_amh_interface_ss::generate_copy_ctor (be_interface *node, node->get_insert_queue ().reset (); node->get_del_queue ().reset (); - // Insert ourselves in the queue. if (node->get_insert_queue ().enqueue_tail (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::traverse_inheritance_graph - " + "(%N:%l) be_interface::generate_copy_ctor - " "error generating entries\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp index 9794c4e8e0a..765b0e5174a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp @@ -59,8 +59,8 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "::CORBA::Boolean" << be_nl << "Any_Impl_T<" << node->name () << ">::to_object (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr &_tao_elem" << be_uidt_nl - << ") const" << be_uidt_nl + << "::CORBA::Object_ptr &_tao_elem) const" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "_tao_elem = ::CORBA::Object::_duplicate (this->value_);" << be_nl << "return true;" << be_uidt_nl @@ -78,8 +78,8 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "Any_Impl_T<" << node->name () << ">::to_abstract_base (" << be_idt << be_idt_nl - << "::CORBA::AbstractBase_ptr &_tao_elem" << be_uidt_nl - << ") const" << be_uidt_nl + << "::CORBA::AbstractBase_ptr &_tao_elem) const" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "_tao_elem = ::CORBA::AbstractBase::_duplicate (this->value_);" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp index 5c81c3159a5..113ec5afd2a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp @@ -117,28 +117,16 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node) if (!node->is_abstract ()) { - *os << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ("; + *os << "TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (" + << "obj.in ());"; } else { - *os << "TAO::AbstractBase_Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ("; + *os << "TAO::AbstractBase_Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (" + << "obj.in ());"; } - *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - } - else - { - *os << "0"; - } - - *os << ");" << be_uidt << be_uidt_nl << be_uidt_nl; + *os << be_nl << be_uidt_nl; *os << "return true;" << be_uidt_nl << "}" << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 53fd3d60e3e..c7f2c0abd69 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -46,20 +46,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) AST_Component *c = AST_Component::narrow_from_decl (node); - if (c != 0) - { - // Forward class declarations for components. - *os << be_nl_2 - << "class " << node->base_proxy_impl_name () - << ";" << be_nl - << "class " << node->remote_proxy_impl_name () - << ";" << be_nl - << "class " << node->base_proxy_broker_name () - << ";" << be_nl - << "class " << node->remote_proxy_broker_name () - << ";"; - } - // Now generate the class definition. *os << be_nl_2 << "class " << be_global->stub_export_macro () @@ -183,18 +169,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << "virtual std::ostream &_tao_stream_v (std::ostream &) const;"; } - if (! node->is_local () && - (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ())) - { - // Add the Proxy Broker member variable. - *os << be_uidt_nl << be_nl - << "private:" << be_idt_nl - << "TAO::Collocation_Proxy_Broker *" - << "the" << node->base_proxy_broker_name () - << "_;"; - } - *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl; @@ -209,18 +183,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << node->local_name () << " (void);" << be_nl_2; } - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "// These methods traverse the " - << "inheritance tree and set the" - << be_nl - << "// parents piece of the given class in the right mode." - << be_nl - << "virtual void " << node->flat_name () - << "_setup_collocation (void);" << be_nl_2; - } } if (node->is_abstract () || node->is_local ()) @@ -263,8 +225,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) { // Friends declarations, component only. *os << be_nl_2 - << "friend class " << node->remote_proxy_impl_name () - << ";" << be_nl << "friend class " << node->direct_proxy_impl_name () << ";"; } @@ -296,9 +256,6 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // Don't support smart proxies for local interfaces. if (! node->is_local ()) { - // List that generates proxy broker factory function pointer. - be_global->non_local_interfaces.enqueue_tail (node); - if (be_global->gen_smart_proxies ()) { *os << be_nl_2; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp index 75a3f3b0ef7..e4944a84974 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -93,13 +93,6 @@ be_visitor_interface_ci::visit_interface (be_interface *node) << "TAO_ORB_Core *oc)" << be_uidt_nl; *os << ": ::CORBA::Object (ior, oc)" << be_idt_nl; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << ", the" << node->base_proxy_broker_name () - << "_ (0)"; - } - *os << be_uidt << be_uidt_nl << "{" << be_nl << "}" ; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index e5036e6ee9c..3dbb0b43fbf 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -149,22 +149,6 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; } - if (!node->is_local () && - (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ())) - { - // Generate the proxy broker factory function pointer definition. - *os << be_nl_2 - << "// Function pointer for collocation factory initialization." - << be_nl - << "TAO::Collocation_Proxy_Broker * " << be_nl - << "(*" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj) = 0;" << be_uidt - << be_uidt; - } - // Generate code for the elements of the interface. if (this->visit_scope (node) == -1) { @@ -189,80 +173,15 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << node->name () << "::" << node->local_name () << " (void)" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl; - } - - *os << "{" << be_idt_nl; + *os << "{" << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "this->" << node->flat_name () - << "_setup_collocation ();" << be_uidt_nl; - } - *os << be_uidt << "}"; - } - - if (! node->is_local () && - (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ())) - { - *os << be_nl_2 - << "void" << be_nl - << node->name () << "::" << node->flat_name () - << "_setup_collocation ()" << be_nl - << "{" << be_idt_nl - << "if (" << "::" - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - - // Right now (29-01-04) we don't support collocation for - // abstract interfaces, and the 'collocated' arg will always - // be 0. However, just to be safe, we add a - // check for non-zero collocation factory function pointer - // (which at present is also 0 for abstract interfaces), - // in case the logic is changed in the future. - if (node->is_abstract ()) - { - *os << " && " << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer"; - } - - *os << ")" << be_idt_nl - << "{" << be_idt_nl - << "this->the" << node->base_proxy_broker_name () - << "_ =" << be_idt_nl - << "::" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer ("; - - if (node->is_abstract ()) - { - *os << be_idt << be_idt_nl - << "this->equivalent_objref ()" << be_uidt_nl - << ");" << be_uidt; - } - else - { - *os << "this);"; - } - - *os << be_uidt << be_uidt_nl - << "}" << be_uidt; - - // Now we setup the immediate parents. - node->gen_parent_collocation (os); - - *os << be_uidt_nl << "}"; + *os << "}"; } *os << be_nl_2 << node->name () << "::~" << node->local_name () << " (void)" << be_nl; - *os << "{}" << be_nl_2; + *os << "{" << be_nl << "}" << be_nl_2; bool gen_any_destructor = be_global->any_support () @@ -488,22 +407,18 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, << "proxy = TAO::Narrow_Utils<" << node->local_name () << ">::" << pre << " ("; - *os << be_idt << be_idt_nl - << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl; + *os << be_idt << be_idt_nl; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else + *os << "_tao_objref"; + if (ACE_OS::strcmp (pre, "narrow") == 0) { - *os << "0" << be_uidt_nl; + *os << "," << be_nl + << "\"" << node->repoID () << "\""; } - *os << ");" << be_uidt << be_nl + + *os << ");"; + + *os << be_uidt << be_uidt << be_nl << "return TAO_" << node->flat_name () << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (proxy);" << be_uidt << be_uidt_nl @@ -525,21 +440,17 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, } *os << be_idt << be_idt_nl - << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl; + << "_tao_objref"; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else + if (ACE_OS::strcmp (pre, "narrow") == 0) { - *os << "0" << be_uidt_nl; + *os << "," << be_nl + << "\"" << node->repoID () << "\""; } - *os << ");" << be_uidt << be_uidt << be_uidt_nl + + *os << ");"; + + *os << be_uidt << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index ab11005da9b..ece9840819c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -90,8 +90,6 @@ be_visitor_interface_sh::visit_interface (be_interface *node) { *os << be_nl_2 << "class " << node->direct_proxy_impl_name () - << ";" << be_nl - << "class " << node->strategized_proxy_broker_name () << ";"; } @@ -224,25 +222,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); - if (be_global->gen_direct_collocation ()) - { - ctx = *this->ctx_; - // Generate strategized proxy broker. - be_visitor_interface_strategized_proxy_broker_sh ispb_visitor (&ctx); - - if (node->accept (&ispb_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_sh::") - ACE_TEXT ("visit_interface - ") - ACE_TEXT ("codegen for strategized ") - ACE_TEXT ("proxy broker class failed\n")), - -1); - } - } - // Generate the collocated class. - ctx = *this->ctx_; if (be_global->gen_direct_collocation ()) diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp index f3a13665ef4..465650b6dc1 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp @@ -78,8 +78,7 @@ be_visitor_interface_si::visit_interface (be_interface *node) status = node->traverse_inheritance_graph ( be_interface::gen_colloc_op_defn_helper, - os - ); + os); if (status == -1) { diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 5d212d693ee..e5b50920af8 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -534,9 +534,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "TAO_IFR_Client_Adapter *_tao_adapter =" << be_idt_nl << "ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (" << be_idt << be_idt_nl - << "TAO_ORB_Core::ifr_client_adapter_name ()" - << be_uidt_nl - << ");" << be_uidt_nl << be_uidt_nl; + << "TAO_ORB_Core::ifr_client_adapter_name ());" + << be_uidt + << be_uidt_nl << be_uidt_nl; *os << "if (!_tao_adapter)" << be_idt_nl << "{" << be_idt_nl << "throw ::CORBA::INTF_REPOS (::CORBA::OMGVMCID | 1, ::CORBA::COMPLETED_NO);" @@ -899,30 +899,19 @@ be_visitor_interface_ss::this_method (be_interface *node) *os << "::CORBA::Object_ptr tmp = CORBA::Object_ptr ();" << be_nl_2; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "::CORBA::Boolean const _tao_opt_colloc =" - << be_idt_nl - << "stub->servant_orb_var ()->orb_core ()->" - << "optimize_collocation_objects ();" << be_uidt_nl << be_nl; - } + *os << "::CORBA::Boolean const _tao_opt_colloc =" + << be_idt_nl + << "stub->servant_orb_var ()->orb_core ()->" + << "optimize_collocation_objects ();" << be_uidt_nl << be_nl; + *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl << "tmp," << be_nl << "::CORBA::Object (stub, "; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "_tao_opt_colloc"; - } - else - { - *os << "false"; - } + *os << "_tao_opt_colloc"; *os << ", this)," << be_nl - << "0" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; + << "0);" << be_uidt << be_uidt_nl << be_nl; *os << "::CORBA::Object_var obj = tmp;" << be_nl << "(void) safe_stub.release ();" << be_nl_2 @@ -931,21 +920,9 @@ be_visitor_interface_ss::this_method (be_interface *node) << "return" << be_idt_nl << "TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (" << be_idt << be_idt_nl - << "obj.in ()," << be_nl; + << "obj.in ());"; - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl; - } - else - { - *os << "0" << be_uidt_nl; - } - - *os << ");" << be_uidt << be_uidt << be_uidt_nl + *os << be_uidt << be_uidt << be_uidt << be_uidt_nl << "}"; } @@ -994,110 +971,8 @@ be_visitor_interface_ss::generate_amh_classes (be_interface *node) int be_visitor_interface_ss::generate_proxy_classes (be_interface *node) { - TAO_OutStream *os = this->ctx_->stream (); be_visitor_context ctx = *this->ctx_; - // Strategized Proxy Broker Implementation. - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) - { - - // Do not generate strategized proxy broker for thru-POA case. - // It isn't necessary. - if (be_global->gen_direct_collocation ()) - { - ctx = *this->ctx_; - be_visitor_interface_strategized_proxy_broker_ss ispb_visitor (&ctx); - - if (node->accept (&ispb_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_ss::") - ACE_TEXT ("generate_proxy_classes - ") - ACE_TEXT ("codegen for Base Proxy Broker ") - ACE_TEXT ("class failed\n")), - -1); - } - } - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // Proxy Broker Factory Function. - *os << be_nl_2 - << "TAO::Collocation_Proxy_Broker *" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function ( ::CORBA::Object_ptr)" - << be_nl - << "{" << be_idt_nl - << "return"; - - if (be_global->gen_direct_collocation ()) - { - *os << be_idt_nl - << "::" - << node->full_strategized_proxy_broker_name () - << "::" <<"the" - << node->strategized_proxy_broker_name () - << " ();" << be_uidt; - } - else - { - // @@ HACK! - - // Dummy function pointer for the thru-POA case. It isn't - // used to call a function but it is used to determine if - // collocation is available. - - // @todo Change the way TAO's ORB_Core detects collocation, - // or at least augment it so that we don't have to - // resort this hack. - *os << " reinterpret_cast<TAO::Collocation_Proxy_Broker *> (0xdead);" - << " // Dummy"; - } - - *os << be_uidt_nl - << "}" << be_nl_2; - - // Proxy Broker Function Pointer Initializer. - *os << "int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (size_t)" << be_nl - << "{" << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer = " - << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function;" - << be_uidt_nl - << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_nl_2; - - *os << "static int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Stub_Factory_Initializer_Scarecrow =" - << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (" << be_idt << be_idt_nl - << "reinterpret_cast<size_t> (" - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer));" << be_uidt << be_uidt << be_uidt_nl; - } - } - if (be_global->gen_direct_collocation ()) { ctx = *this->ctx_; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp deleted file mode 100644 index 8dddfb293be..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -// $Id$ -// - -be_visitor_interface_strategized_proxy_broker_sh:: -be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ - // No-Op. -} - -be_visitor_interface_strategized_proxy_broker_sh:: -~be_visitor_interface_strategized_proxy_broker_sh (void) -{ - // No-Op. -} - -int -be_visitor_interface_strategized_proxy_broker_sh::visit_interface ( - be_interface *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl_2 - << "///////////////////////////////////////////////////////////////////////" - << be_nl - << "// Strategized Proxy Broker Declaration " << be_nl - << "//" << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "class " << be_global->skel_export_macro () << " " - << node->strategized_proxy_broker_name () << be_idt_nl - << ": public virtual " - << "TAO::Collocation_Proxy_Broker" << be_uidt_nl << "{" - << be_nl - << "public: " << be_idt; - - // Destructor - *os << be_nl - << "virtual ~" << node->strategized_proxy_broker_name () << " (void);"; - - *os << be_nl_2 - << "TAO::Collocation_Strategy " - << "get_strategy (::CORBA::Object_ptr obj);" << be_nl; - - *os << be_nl - << "void" << be_nl - << "dispatch (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj," << be_nl - << "::CORBA::Object_out forward_obj," << be_nl - << "bool &is_forwarded," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args," << be_nl - << "const char * op," << be_nl - << "size_t op_len," << be_nl - << "TAO::Collocation_Strategy strategy" << be_uidt_nl - << ");" << be_uidt_nl; - - *os << be_nl - << "static " << node->strategized_proxy_broker_name () - << " *" << be_nl - << "the" << node->strategized_proxy_broker_name () - << " (void);" << be_uidt_nl; - - *os << "};"; - - *os << be_nl_2 - << "//" << be_nl - << "// End Strategized Proxy Broker Declaration " << be_nl - << "///////////////////////////////////////////////////////////////////////" - << be_nl_2; - - return 0; -} - -int be_visitor_interface_strategized_proxy_broker_sh::visit_component ( - be_component *node) -{ - return this->visit_interface (node); -} - -int be_visitor_interface_strategized_proxy_broker_sh::visit_connector ( - be_connector *node) -{ - return this->visit_component (node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp deleted file mode 100644 index 5aafa765692..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// -// $Id$ - -be_visitor_interface_strategized_proxy_broker_ss:: -be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ - // No-Op. -} - - -be_visitor_interface_strategized_proxy_broker_ss:: -~be_visitor_interface_strategized_proxy_broker_ss (void) -{ - // No-Op. -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( - be_interface *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Generate the class declaration. - os->indent (); - - *os << be_nl - << "///////////////////////////////////////////////////////////////////////" - << be_nl - << "// Strategized Proxy Broker Implementation" << be_nl - << "//" << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "// Global static proxy broker." << be_nl - << "static " << node->full_strategized_proxy_broker_name () << be_nl - << "tao_" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << ";" << be_nl_2; - - *os << "// Factory function Implementation." << be_nl - << node->full_strategized_proxy_broker_name () - << " *" << be_nl - << node->full_strategized_proxy_broker_name () << "::the" - << node->strategized_proxy_broker_name () - << " (void)" << be_nl - << "{" << be_idt_nl - << "return &" << "tao_" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () << ";" << be_uidt_nl - << "}" << be_nl_2; - - // Destructor Implementation. - *os << node->full_strategized_proxy_broker_name () << "::~" - << node->strategized_proxy_broker_name () << " (void)" << be_nl - << "{" << be_nl - << "}" << be_nl_2; - - // get_strategy() impementation. - *os << "TAO::Collocation_Strategy" << be_nl - << node->full_strategized_proxy_broker_name () << "::" - << "get_strategy (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj)" << be_uidt << be_uidt_nl - << "{" << be_idt_nl - << "return TAO_ORB_Core::collocation_strategy (obj);" << be_uidt_nl - << "}" << be_nl_2; - - // create_proxy implementation - *os << "void" << be_nl - << node->full_strategized_proxy_broker_name () << "::" - << "dispatch (" << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj," << be_nl - << "::CORBA::Object_out forward_obj," << be_nl - << "bool & is_forwarded," << be_nl - << "TAO::Argument ** args," << be_nl - << "int num_args," << be_nl - << "const char * op," << be_nl - << "size_t op_len," << be_nl - << "TAO::Collocation_Strategy strategy)" << be_uidt << be_uidt_nl - << "{" << be_idt_nl - << "TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;" << be_nl - << "collocation_upcall_wrapper.upcall (" << be_idt_nl - << "obj," << be_nl - << "forward_obj," << be_nl - << "is_forwarded," << be_nl - << "args," << be_nl - << "num_args," << be_nl - << "op," << be_nl - << "op_len," << be_nl - << "strategy);" << be_uidt << be_uidt_nl - << "}"; - - *os << be_nl_2 - << "//" << be_nl - << "// End Strategized Proxy Broker Implementation" << be_nl - << "///////////////////////////////////////////////////////////////////////"; - - return 0; -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_component ( - be_component *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_interface_strategized_proxy_broker_ss::visit_connector ( - be_connector *node) -{ - return this->visit_component (node); -} - -void -be_visitor_interface_strategized_proxy_broker_ss::gen_direct_operations ( - be_interface *, - TAO_OutStream *) -{ -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp index 1edecc7e41c..948d44f0d4a 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp @@ -131,17 +131,6 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "::CORBA::Object::tao_object_initialize (this);" << be_uidt_nl << "}" << be_uidt_nl << be_nl; - - if (be_global->gen_direct_collocation() - || be_global->gen_thru_poa_collocation ()) - { - *os << "if (this->the_TAO_" << parent->local_name () - << "_Proxy_Broker_ == 0)" << be_idt_nl - << "{" << be_idt_nl - << parent->flat_name () << "_setup_collocation (" - << ");" << be_uidt_nl - << "}" << be_uidt; - } } // Includes the reply handler, but we have to add 1 for the retval anyway. @@ -192,8 +181,6 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "};" << be_uidt; } - be_interface *intf = be_interface::narrow_from_decl (parent); - ACE_CString base (node->local_name ()->get_string ()); /// The sendc_* operation makes the invocation with the @@ -216,13 +203,14 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "\"" << op_name << "\"," << be_nl << len << "," << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + *os << "TAO::TAO_CO_NONE"; + if (be_global->gen_direct_collocation()) { - *os << "this->the" << intf->base_proxy_broker_name () << "_"; + *os << " | TAO::TAO_CO_DIRECT_STRATEGY"; } - else + if (be_global->gen_thru_poa_collocation()) { - *os << "0"; + *os << " | TAO::TAO_CO_THRU_POA_STRATEGY"; } *os << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp deleted file mode 100644 index 2b2aa030fd0..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/base_proxy_impl_ch.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// $Id$ - -be_visitor_operation_base_proxy_impl_ch:: -be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_operation_base_proxy_impl_ch:: -~be_visitor_operation_base_proxy_impl_ch (void) -{ -} - -int be_visitor_operation_base_proxy_impl_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - *os << "virtual "; - - // STEP I: generate the return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - be_visitor_context ctx (*this->ctx_); - be_visitor_operation_rettype oro_visitor (&ctx); - - if (bt->accept (&oro_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - // STEP 2: generate the operation name - *os << this->ctx_->port_prefix ().c_str () - << " " << node->local_name (); - - // STEP 3: generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH); - be_visitor_operation_arglist oabpi_visitor (&ctx); - - if (node->accept (&oabpi_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_sh::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp index b62d7224634..e9c60885335 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp @@ -54,7 +54,7 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( } *os << "// TAO_IDL - Generated from " << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; + << "// " << __FILE__ << ":" << __LINE__ << be_nl; *os << "void" << be_nl << intf->full_direct_proxy_impl_name () << "::"; @@ -83,21 +83,11 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << " args"; } - *os << "," << be_nl - << "int)" << be_uidt_nl; + *os << ")" << be_uidt_nl; *os << be_uidt_nl << "{" << be_idt_nl; -#if 0 - << "TAO::Portable_Server::Servant_Upcall servant_upcall (" - << be_idt << be_idt_nl - << "obj->_stubobj ()" - << "->servant_orb_var ()->orb_core ()" - << be_uidt_nl - << ");" << be_uidt_nl << be_nl; -#endif /*if 0*/ - if (!node->void_return_type ()) { *os << "((TAO::Arg_Traits< "; @@ -125,10 +115,9 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << be_uidt; } - *os << be_uidt << be_uidt_nl; + *os << be_uidt << be_uidt << be_uidt_nl; - *os << be_uidt_nl - << "}" << be_nl; + *os << "}" << be_nl << be_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index bf7102103a5..fe40b0d6b14 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -168,8 +168,7 @@ be_visitor_operation::gen_stub_operation_body ( if (node->has_native ()) // native exists => no stub { - if (this->gen_raise_exception ("::CORBA::MARSHAL", - "") == -1) + if (this->gen_raise_exception ("::CORBA::MARSHAL", "") == -1) { ACE_ERROR_RETURN (( LM_ERROR, @@ -195,16 +194,6 @@ be_visitor_operation::gen_stub_operation_body ( << "::CORBA::Object::tao_object_initialize (this);" << be_uidt_nl << "}" << be_uidt_nl << be_nl; - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)" - << be_idt_nl - << "{" << be_idt_nl - << intf->flat_name () << "_setup_collocation ();" - << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } } // Declare return type helper class. @@ -291,13 +280,14 @@ be_visitor_operation::gen_stub_operation_body ( *os << lname << "\"," << be_nl << len << "," << be_nl; - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + *os << "TAO::TAO_CO_NONE"; + if (be_global->gen_direct_collocation()) { - *os << "this->the" << intf->base_proxy_broker_name () << "_"; + *os << " | TAO::TAO_CO_DIRECT_STRATEGY"; } - else + if (be_global->gen_thru_poa_collocation()) { - *os << "0"; + *os << " | TAO::TAO_CO_THRU_POA_STRATEGY"; } if (node->flags () == AST_Operation::OP_oneway) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp index 711b4abb1b0..d2c9175b538 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp @@ -45,8 +45,8 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node) *os << this->ctx_->port_prefix ().c_str () << node->local_name () << " (" << be_idt_nl << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args, " - << "int num_args);" << be_uidt_nl; + << "TAO::Argument **args);" + << be_uidt_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp deleted file mode 100644 index 81436f6c775..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// $Id$ - -// ************************************************************ -// Operation visitor for client stubs -// ************************************************************ - -be_visitor_operation_remote_proxy_impl_cs:: -be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_remote_proxy_impl_cs:: -~be_visitor_operation_remote_proxy_impl_cs (void) -{ -} - -// Processing to be done after every element in the scope is processed. -int -be_visitor_operation_remote_proxy_impl_cs::post_process (be_decl *bd) -{ - // All we do here is to insert a comma and a newline. - TAO_OutStream *os = this->ctx_->stream (); - - if (!this->last_node (bd)) - { - *os << "," << be_nl; - } - - return 0; -} - -int -be_visitor_operation_remote_proxy_impl_cs::visit_operation ( - be_operation *node - ) -{ - if (node->is_local ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // Retrieve the operation return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - // Generate the return type mapping (same as in the header file) - be_visitor_context ctx = *this->ctx_; - be_visitor_operation_rettype ort_visitor (&ctx); - - if (bt->accept (&ort_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - // Generate the operation name - be_decl* scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); - be_interface *interface = be_interface::narrow_from_decl (scope); - - *os <<" " << interface->full_remote_proxy_impl_name () - << "::" << node->local_name (); - - // Generate the argument list with the appropriate mapping (same as - // in the header file). - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS); - be_visitor_operation_arglist arglist_visitor (&ctx); - - if (node->accept (&arglist_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - // Generate the code for the operation body. - return this->gen_stub_operation_body (node, - bt); -} - -int -be_visitor_operation_remote_proxy_impl_cs::visit_argument (be_argument *node) -{ - // This method is used to generate the ParamData table entry. - - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt = 0; - - // Retrieve the type for this argument. - bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - *os << "{" << bt->tc_name () << ", "; - - switch (node->direction ()) - { - case AST_Argument::dir_IN: - *os << "PARAM_IN, "; - break; - case AST_Argument::dir_INOUT: - *os << "PARAM_INOUT, "; - break; - case AST_Argument::dir_OUT: - *os << "PARAM_OUT, "; - break; - } - *os << "0}"; - - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp index ed167664904..d02650ec314 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp @@ -59,8 +59,6 @@ be_visitor_root_ch::visit_root (be_root *node) } } - this->gen_proxy_broker_factory_pointers (); - this->gen_ref_counting_overrides (); this->gen_static_corba_overrides (); @@ -153,8 +151,6 @@ be_visitor_root_ch::gen_arg_traits (be_root *node) void be_visitor_root_ch::gen_fwd_decls (void) { - // If this IDL file contains an non local interface declaration, generate a - // forward declaration of the proxy broker for a possible collocated call. if (idl_global->non_local_iface_seen_) { *o_ << be_nl_2 @@ -167,11 +163,6 @@ be_visitor_root_ch::gen_fwd_decls (void) << "namespace TAO" << be_nl << "{" << be_idt_nl; - if (be_global->gen_direct_collocation () || be_global->gen_thru_poa_collocation ()) - { - *o_ << "class Collocation_Proxy_Broker;" << be_nl; - } - if (idl_global->abstract_iface_seen_) { *o_ << "template<typename T> class AbstractBase_Narrow_Utils;" << be_nl; @@ -185,43 +176,6 @@ be_visitor_root_ch::gen_fwd_decls (void) } void -be_visitor_root_ch::gen_proxy_broker_factory_pointers (void) -{ - size_t size = be_global->non_local_interfaces.size (); - - if (size == 0) - { - return; - } - - size_t index = 0; - be_interface *i = 0; - - *o_ << be_nl_2 - << "// Proxy Broker Factory function pointer declarations." - << be_nl_2 - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - for (index = 0; index < size; ++index) - { - be_global->non_local_interfaces.dequeue_head (i); - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *o_ << be_nl_2 - << "extern " << be_global->stub_export_macro () << be_nl - << "TAO::Collocation_Proxy_Broker *" << be_nl - << "(*" << i->flat_client_enclosing_scope () - << i->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj);" << be_uidt << be_uidt; - } - } -} - -void be_visitor_root_ch::gen_ref_counting_overrides (void) { size_t size = be_global->non_defined_interfaces.size (); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp index 4cd24333daa..dc695cb2c7f 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp @@ -241,8 +241,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -257,8 +257,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl @@ -270,8 +270,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -298,8 +298,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" @@ -321,8 +321,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" << be_idt << be_idt_nl @@ -337,8 +337,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl @@ -350,8 +350,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << "// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract (" @@ -359,8 +359,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << (td != 0 ? td->tc_name () : node->tc_name ()) << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp index d64029fdd43..f5becf9ca44 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp @@ -108,11 +108,11 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) be_util::gen_nested_namespace_begin (os, module); // Copying insertion. - *os << "// Copying insertion." << be_nl + *os << "/// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " &_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl @@ -125,45 +125,45 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion. - *os << "// Non-copying insertion." << be_nl + *os << "/// Non-copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any, ::" << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::insert (" << be_idt << be_idt_nl << "_tao_any," << be_nl << "::" << node->name () << "::_tao_any_destructor," << be_nl << "::" << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer (deprecated, just calls the other). - *os << "// Extraction to non-const pointer (deprecated)." << be_nl + *os << "/// Extraction to non-const pointer (deprecated)." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const ::" << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer. - *os << "// Extraction to const pointer." << be_nl + *os << "/// Extraction to const pointer." << be_nl << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const ::" << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const ::" << node->name () << " *&_tao_elem)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T< ::" << node->name () << ">::extract (" @@ -186,11 +186,11 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) *os << be_global->core_versioning_begin () << be_nl; // Copying insertion. - *os << "// Copying insertion." << be_nl - << "void operator<<= (" << be_idt << be_idt_nl + *os << "/// Copying insertion." << be_nl + << "void operator<<= (" << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " &_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " &_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "if (0 == &_tao_elem) // Trying to de-reference NULL object" << be_idt_nl @@ -198,58 +198,58 @@ be_visitor_structure_any_op_cs::visit_structure (be_structure *node) << "else" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert_copy (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl_2; // Non-copying insertion. - *os << "// Non-copying insertion." << be_nl - << "void operator<<= (" << be_idt << be_idt_nl + *os << "/// Non-copying insertion." << be_nl + << "void operator<<= (" << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl - << node->name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::insert (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to non-const pointer (deprecated, just calls the other). - *os << "// Extraction to non-const pointer (deprecated)." << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl + *os << "/// Extraction to non-const pointer (deprecated)." << be_nl + << "::CORBA::Boolean operator>>= (" << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << node->name () << " *&_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "return _tao_any >>= const_cast<" << be_idt << be_idt_nl << "const " << node->name () << " *&> (" << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "_tao_elem);" << be_uidt + << be_uidt << be_uidt_nl << "}" << be_nl_2; // Extraction to const pointer. - *os << "// Extraction to const pointer." << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl + *os << "/// Extraction to const pointer." << be_nl + << "::CORBA::Boolean operator>>= (" << be_idt_nl << "const ::CORBA::Any &_tao_any," << be_nl - << "const " << node->name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl + << "const " << node->name () << " *&_tao_elem)" + << be_uidt_nl << "{" << be_idt_nl << "return" << be_idt_nl << "TAO::Any_Dual_Impl_T<" << node->name () << ">::extract (" - << be_idt << be_idt_nl + << be_idt_nl << "_tao_any," << be_nl << node->name () << "::_tao_any_destructor," << be_nl << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "_tao_elem);" + << be_uidt << be_uidt << be_uidt_nl << "}"; *os << be_global->core_versioning_end () << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp index a7b20bd1351..29ed2af7efc 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp @@ -78,12 +78,6 @@ be_visitor_valuetype_sh::visit_valuetype (be_valuetype *node) *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; } - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->strategized_proxy_broker_name () - << ";" << be_nl; - } - *os << be_nl; // Now generate the class definition. diff --git a/TAO/TAO_IDL/be_include/be_component.h b/TAO/TAO_IDL/be_include/be_component.h index 0122cdb0f15..07a91da0ed4 100644 --- a/TAO/TAO_IDL/be_include/be_component.h +++ b/TAO/TAO_IDL/be_include/be_component.h @@ -77,9 +77,6 @@ public: /// Generate the string compares for ancestors in _is_a(). virtual int gen_is_a_ancestors (TAO_OutStream *os); - /// Generate setup_collocation() for base component, if any. - virtual void gen_parent_collocation (TAO_OutStream *os); - // Narrowing. DEF_NARROW_FROM_DECL (be_component); diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index cdb382f7526..4838d0b77ff 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -766,10 +766,6 @@ public: /// Cleanup function. void destroy (void); - /// Used in the generation of declarations for - /// xxx_Proxy_Broker_Factory_function_pointer. - ACE_Unbounded_Queue<be_interface *> non_local_interfaces; - /// Used in the generation of extern function declarations so we /// can use non-defined interfaces as members and parameters. ACE_Unbounded_Queue<be_interface_fwd *> non_defined_interfaces; diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index 2591251a3b8..65bb4bec8ee 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -69,20 +69,6 @@ public: /// Retrieve the fully qualified collocated class name. const char *local_coll_name (int); - /// retrieve the name of the base proxy implementation. - virtual const char *base_proxy_impl_name (void); - - /// retrieve the fully qualified name of the base proxy - /// implementation. - virtual const char *full_base_proxy_impl_name (void); - - /// retrieve the name of the remote proxy implementation. - virtual const char *remote_proxy_impl_name (void); - - /// retrieve the fully qualified name of the remote - /// proxy implementation. - virtual const char *full_remote_proxy_impl_name (void); - /// retrieve the name of the direct proxy implementation. virtual const char *direct_proxy_impl_name (void); @@ -90,26 +76,6 @@ public: /// implementation. virtual const char *full_direct_proxy_impl_name (void); - /// retrieve the name of the base proxy broker. - virtual const char *base_proxy_broker_name (void); - - /// retrieve the fully qualified name of the base proxy broker. - virtual const char *full_base_proxy_broker_name (void); - - /// retrieve the name of the remote proxy broker implementation. - virtual const char *remote_proxy_broker_name (void); - - /// retrieve the fully qualified name of the remote proxy broker - /// implementation. - virtual const char *full_remote_proxy_broker_name (void); - - /// retrieve the name of the strategized proxy broker implementation. - virtual const char *strategized_proxy_broker_name (void); - - /// retrieve the fully qualified name of the strategized proxy broker - /// implementation. - virtual const char *full_strategized_proxy_broker_name (void); - /// Return the client scope that encloses the interface. virtual const char *client_enclosing_scope (void); @@ -344,9 +310,6 @@ public: /// Generate the string compares for ancestors in _is_a(). virtual int gen_is_a_ancestors (TAO_OutStream *os); - /// Generate setup_collocation() for base component, if any. - virtual void gen_parent_collocation (TAO_OutStream *os); - protected: /** * CDreate a new string made by the concatenation @@ -362,16 +325,12 @@ protected: enum Suffix_Code { PROXY_IMPL = 0, - PROXY_BROKER = 1 }; enum Tag_Code { - THRU_POA = 0, - DIRECT = 1, - REMOTE = 2, - STRATEGIZED = 3, - GC_PREFIX = 4 // Prefix used for the generated class + DIRECT = 0, + GC_PREFIX = 1 // Prefix used for the generated class // This prefix is used to avoid name conflicts // with the user classes. }; @@ -380,23 +339,10 @@ protected: static const char *tag_table_[]; // Proxy Implementation names. - char *base_proxy_impl_name_; - char *remote_proxy_impl_name_; char *direct_proxy_impl_name_; - char *full_base_proxy_impl_name_; - char *full_remote_proxy_impl_name_; char *full_direct_proxy_impl_name_; - // Proxy Broker Names. - char *base_proxy_broker_; - char *remote_proxy_broker_; - char *strategized_proxy_broker_; - - char *full_base_proxy_broker_name_; - char *full_remote_proxy_broker_name_; - char *full_strategized_proxy_broker_name_; - char *client_scope_; char *flat_client_scope_; diff --git a/TAO/TAO_IDL/be_include/be_valuetype.h b/TAO/TAO_IDL/be_include/be_valuetype.h index c92b4952dcd..ae090cbc735 100644 --- a/TAO/TAO_IDL/be_include/be_valuetype.h +++ b/TAO/TAO_IDL/be_include/be_valuetype.h @@ -126,12 +126,6 @@ public: be_interface *base, TAO_OutStream *os); - /// Helper method to generate *_skel operations for the concrete - /// interface that we support (if any) and those of its base classes. - static int gen_skel_helper (be_interface *node, - be_interface *base, - TAO_OutStream *os); - /// Accessor to the member. const char *fwd_helper_name (void) const; diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index 516196294a6..740fa08dcae 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -42,10 +42,6 @@ #include "be_visitor_interface/smart_proxy_ch.h" #include "be_visitor_interface/smart_proxy_cs.h" -// Proxy Brokers -#include "be_visitor_interface/strategized_proxy_broker_sh.h" -#include "be_visitor_interface/strategized_proxy_broker_ss.h" - // Proxy Impls #include "be_visitor_interface/direct_proxy_impl_sh.h" #include "be_visitor_interface/direct_proxy_impl_ss.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h index bbd8e6723c4..77eb09dc377 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h @@ -21,11 +21,11 @@ public: int visit_interface (be_interface *node); + // Helper method passed to the template method to generate code for the + // AMH skeletons in the inline files. static int gen_skel_helper (be_interface *, be_interface *, TAO_OutStream *); - // Helper method passed to the template method to generate code for the - // AMH skeletons in the inline files. }; #endif /* AMH_SH_I_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h deleted file mode 100644 index 36d89682895..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_sh.h +++ /dev/null @@ -1,47 +0,0 @@ -//============================================================================= -/** - * @file strategized_proxy_broker_sh.h - * - * $Id$ - * - * Concrete visitor for the Interface node. This - * visitor generates the declaration for the strategized - * ProxyBroker class. - * - * - * @author Angelo Corsaro <corsaro@cs.wustl.edu> - */ -//============================================================================= - - -#ifndef BE_STRATEGIZED_PROXY_BROKER_SH_H_ -#define BE_STRATEGIZED_PROXY_BROKER_SH_H_ - -/** - * @class be_visitor_interface_strategized_proxy_broker_sh - * - * @brief Generates the declaration for the base proxy - * broker class. - */ -class be_visitor_interface_strategized_proxy_broker_sh : public be_visitor_interface -{ - -public: - // -- Ctor/Dtor Decl. -- - be_visitor_interface_strategized_proxy_broker_sh (be_visitor_context *ctx); - - virtual ~be_visitor_interface_strategized_proxy_broker_sh (void); - - /// visit an interface - virtual int visit_interface (be_interface *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_component (be_component *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_connector (be_connector *node); -}; - -#endif /* BE_STRATEGIZED_PROXY_BROKER_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h deleted file mode 100644 index 8962eed07f8..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -/** - * @file strategized_proxy_broker_ss.h - * - * $Id$ - * - * Concrete visitor for the Interface node. This - * visitor generates the declaration for the strategized - * ProxyBroker class. - * - * - * @author Angelo Corsaro <corsaro@cs.wustl.edu> - */ -//============================================================================= - -#ifndef BE_STRATEGIZED_PROXY_BROKER_SS_H_ -#define BE_STRATEGIZED_PROXY_BROKER_SS_H_ - -/** - * @class be_visitor_interface_direct_proxy_impl_ss - * - * @brief Generates the implementation for the base proxy - * broker class. - */ -class be_visitor_interface_strategized_proxy_broker_ss - : public be_visitor_interface -{ -public: - // -- Ctor/Dtor Decl. -- - be_visitor_interface_strategized_proxy_broker_ss (be_visitor_context *ctx); - - virtual ~be_visitor_interface_strategized_proxy_broker_ss (void); - - /// visit an interface - virtual int visit_interface (be_interface *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_component (be_component *node); - - /// This will just call the above method - no need to create - /// another set of visitors for this stuff. - virtual int visit_connector (be_connector *node); - -private: - void gen_direct_operations (be_interface *node, TAO_OutStream *os); -}; - -#endif /* BE_STRATEGIZED_PROXY_BROKER_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h deleted file mode 100644 index 6634ce65a66..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/base_proxy_impl_ch.h +++ /dev/null @@ -1,40 +0,0 @@ -//============================================================================= -/** - * @file base_proxy_impl_ch.h - * - * $Id$ - * - * Visitor for generating code for proxy implementations. - * - * - * @author Angelo Corsaro - */ -//============================================================================= - - -#ifndef _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ -#define _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ - - -/** - * @class be_visitor_operation_base_proxy_impl_ch - * - * @brief be_visitor_operation_base_proxy_impl_ch - * - * Concrete visitor that generates the code for the base class - * of Proxy Impls. - */ -class be_visitor_operation_base_proxy_impl_ch : public be_visitor_scope -{ -public: - /// constructor - be_visitor_operation_base_proxy_impl_ch (be_visitor_context *ctx); - - /// destructor - ~be_visitor_operation_base_proxy_impl_ch (void); - - /// visit operation. - virtual int visit_operation (be_operation *node); -}; - -#endif /* _BE_VISITOR_OPERATION_BASE_PROXY_IMPL_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h deleted file mode 100644 index cbc22ba84d7..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/remote_proxy_impl_cs.h +++ /dev/null @@ -1,54 +0,0 @@ -//============================================================================= -/** - * @file remote_proxy_impl_cs.h - * - * $Id$ - * - * Visitor for generating code for remote proxy impls - * in client stubs. - * - * - * - * @author Aniruddha Gokhale & Angelo Corsaro - */ -//============================================================================= - - -#ifndef _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ -#define _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ - -// ************************************************************ -// Operation_Remote_Proxy_Impl visitor for client stubs -// ************************************************************ - -/** - * @class be_visitor_operation_remote_proxy_impl_cs - * - * @brief be_visitor_operation_remote_proxy_impl_cs - * - * This is a concrete visitor to generate the client invocation - * code for the Remote Proxy Implementation. - */ -class be_visitor_operation_remote_proxy_impl_cs : public be_visitor_operation -{ -public: - /// constructor - be_visitor_operation_remote_proxy_impl_cs (be_visitor_context *ctx); - - /// destructor - ~be_visitor_operation_remote_proxy_impl_cs (void); - - /// visit operation_remote_proxy_impl. - virtual int visit_operation (be_operation *node); - - /// visit argument to generate ParamData entries - virtual int visit_argument (be_argument *node); - - // = template methods - - // =helper - /// stuff to output after every member of the scope is handled - virtual int post_process (be_decl *); -}; - -#endif /* _BE_VISITOR_OPERATION_REMOTE_PROXY_IMPL_OPERATION_REMOTE_PROXY_IMPL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h index 8bf913f21db..14ac16e5a56 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h @@ -44,7 +44,6 @@ private: /// the main scope traversal. int gen_arg_traits (be_root *node); void gen_fwd_decls (void); - void gen_proxy_broker_factory_pointers (void); void gen_ref_counting_overrides (void); void gen_static_corba_overrides (void); int gen_obv_decls (be_root *node); diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 9fd01633c5f..2021797303f 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -34,6 +34,13 @@ TAO/tests/AMH_Exceptions/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO ! TAO/tests/AMH_Oneway/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_ToFix_LynxOS_x86 !ACE_FOR_TAO TAO/tests/CORBA_e_Implicit_Activation/run_test.pl: CORBA_E_COMPACT TAO/tests/Collocation/run_test.pl: !ACE_FOR_TAO +TAO/tests/Collocated_NoColl/run_test.pl: !ST +TAO/tests/Collocated_DerivedIF/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl: !ST +TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl: !ST +TAO/tests/Collocated_ThruP_Sp/run_test.pl: !ST +TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl: !ST TAO/tests/Collocation_Tests/run_test.pl: !ST TAO/tests/Collocation_Opportunities/run_test.pl: !ST !CORBA_E_MICRO TAO/tests/Collocation_Oneway_Tests/run_test.pl: !ST !NO_MESSAGING !CORBA_E_MICRO @@ -304,6 +311,7 @@ TAO/tests/POA/Default_Servant2/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_M TAO/tests/POA/Explicit_Activation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO TAO/tests/POA/FindPOA/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/POA/NewPOA/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/tests/POA/On_Demand_Activation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO TAO/tests/POA/On_Demand_Loading/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !KCC_Linux !ACE_FOR_TAO TAO/tests/POA/Reference_Counted_Servant/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index fd8b5147c48..40995028e39 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -385,17 +385,20 @@ treated as collocated. When <em>no</em> is specified, no objects are treated as collocated. </td> </tr> <tr> - <td><code>-ORBCollocationStrategy</code> <em>thru_poa/direct</em> + <td><code>-ORBCollocationStrategy</code> <em>thru_poa/direct/best</em> </td> - <td>Specifies what type of collocated object to use. If the <code>thru_poa</code> -(default) strategy is used, TAO uses the collocation object + <td>Specifies what type of collocated object to use. If not specified +the TAO_DEFAULT_COLLOCATION_STRATEGY default (default on thru_poa) is used. +If the <code>thru_poa</code> strategy is used, TAO uses the collocation object implementation that respects POA's current state and policies. When using the <code>direct</code> strategy, method invocations on collocated objects become direct calls to servant without checking POA's status, which can increase performance. If you use the <code>direct</code> strategy, your interfaces must be compiled with the <code><a href="compiler.html#collocation-stubs">-Gd</a></code> IDL <a - href="compiler.html">compiler option</a>. </td> + href="compiler.html">compiler option</a>. If you choose for the <code>best</code> strategy, + TAO tries to perform the best possible collocation, first <code>direct</code> collocation if possible, +else <code>thru_poa</code> collocation if possible and otherwise no collocation. </td> </tr> <tr> <td><code>-ORBAMICollocation</code> <em>1|0</em> diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp index e3aa2a1a293..ee2cb97d618 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp @@ -196,7 +196,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Run the event loop. ACE_DEBUG ((LM_DEBUG, "running the event loop:\n" - "*** message: ready to receieve stock information...\n\n")); + "*** message: ready to receive stock information...\n\n")); orb->run (); // Cleanup the POA and ORB. diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html b/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html index 8738fbe78a0..64525c7cdf9 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html +++ b/TAO/docs/tutorials/Quoter/RTCORBA/docs/distributor.html @@ -32,7 +32,7 @@ which is a subclass of POA_Stock::StockQuoter class. <P> <hr><h3>Implementation of StockDistributorHome interface</h3> -This interface is used to register the necessary factories and mappings with the specified orb and +This interface is used to register the necessary factories and mappings with the specified orb and create StockDistributor objects. <P> The Stock_StockDistributorHome_i class is generated automatically by the IDL compiler (using the -GI flag), @@ -48,7 +48,7 @@ The main steps of this function are described as follows: <P> <PRE> if (orb_->orb_core ()->reactor ()->register_handler (SIGINT, this) == -1) - ACE_DEBUG ((LM_DEBUG, "ERROR: Failed to register as a signal handler: %p\n", + ACE_DEBUG ((LM_DEBUG, "ERROR: Failed to register as a signal handler: %p\n", "register_handler\n")); </PRE> @@ -76,7 +76,7 @@ The main steps of this function are described as follows: <P> <li>Create a CORBA::PolicyList for the child POA.</li> -This step include several sub-stpes: +This step include several sub-steps: <OL> <li> Get a reference to the RTORB.</li> <li> Initialize a CORBA::PolicyList object.</li> @@ -90,38 +90,38 @@ create a lane for each priority.</li> <PRE> CORBA::Object_var obj = orb_->resolve_initial_references ("RTORB"); RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (obj.in ()); - + TAO::Utils::PolicyList_Destroyer policies (2); policies.length (2); - + policies[0] = rt_orb->create_priority_model_policy (RTCORBA::SERVER_DECLARED, Stock::Priority_Mapping::VERY_LOW); - + RTCORBA::ThreadpoolLanes lanes (5); lanes.length (5); - - for (CORBA::ULong i = 0; i < lanes.length (); ++i) + + for (CORBA::ULong i = 0; i < lanes.length (); ++i) { lanes[i].lane_priority = static_cast<RTCORBA::Priority> (i); lanes[i].static_threads = 5; lanes[i].dynamic_threads = 0; } - - RTCORBA::ThreadpoolId threadpool_id = + + RTCORBA::ThreadpoolId threadpool_id = rt_orb->create_threadpool_with_lanes (1024*1024, lanes, false, false, 0, 0); - + policies[1] = rt_orb->create_threadpool_policy (threadpool_id); PortableServer::POA_var poa = this->_default_POA (); PortableServer::POAManager_var poa_mgr = poa->the_POAManager (); - + PortableServer::POA_var child_poa = - poa->create_POA ("StockDistributor_POA", + poa->create_POA ("StockDistributor_POA", poa_mgr.in (), policies); - + this->rt_poa_ = RTPortableServer::POA::_narrow (child_poa.in ()); </PRE> @@ -133,7 +133,7 @@ create a lane for each priority.</li> <h4>Implementing the create_distributor () member function</h4> -<li>Create a new instance of the StockDistributor_i. Then activate it under the located POA. +<li>Create a new instance of the StockDistributor_i. Then activate it under the located POA. This will cause the object to have the CLIENT_PROPAGATED policies. </li> <PRE> @@ -179,7 +179,7 @@ which is a subclass of POA_Stock::StockDistributor class. <P> orb_ (CORBA::ORB::_duplicate (poa->_get_orb ())) </PRE> -The "rate_" and "active_" are two private members of the Stock_StockDistributor_i class. They stand +The "rate_" and "active_" are two private members of the Stock_StockDistributor_i class. They stand for the notification rate and the active state of the StockDistributor object. <P> <h4>Implementing the subscribe_notifier () member function</h4> @@ -190,7 +190,7 @@ The main steps of this function are described as follows: <P> <li>Generate an unique id for the cookie and use it to create a new Cookie object.</li> <P> -<li>Insert the StockNameConsumer object and its priority into the StockDistributor object's subscriber map, +<li>Insert the StockNameConsumer object and its priority into the StockDistributor object's subscriber map, using the cookie id as the key.</li> <P> <li>Return the Cookie object.</li> <P> @@ -202,7 +202,7 @@ The main steps of this function are described as follows: <P> <li>Check the value of the Cookie object.</li> <P> <li>Get the write thread mutex of the subscriber map.</li> <P> - + <li>Search for the Cookie object in the argument in the StockDistributor object's subscriber map.</li> <P> <li>Erase the Cookie object from the StockDistributor object's subscribers' map.</li> <P> @@ -212,7 +212,7 @@ The main steps of this function are described as follows: <P> <h4>Implementing the provide_quoter_info () member function</h4> <li>Get the read thread mutex of the subscriber map.</li> <P> - + <li>Search for the Cookie object in the argument in the StockDistributor object's subscriber map.</li> <P> <PRE> @@ -224,11 +224,11 @@ The main steps of this function are described as follows: <P> <PRE> Stock_StockQuoter_i *quoter = new Stock_StockQuoter_i; PortableServer::ServantBase_var owner_transfer (quoter); - - PortableServer::ObjectId *oid = + + PortableServer::ObjectId *oid = this->rt_poa_->activate_object_with_priority (quoter, iter->second.second); - + CORBA::Object_var obj = rt_poa_->id_to_reference (*oid); Stock::StockQuoter_var quoter_var = ::Stock::StockQuoter::_narrow (obj.in ()); </PRE> @@ -257,12 +257,12 @@ While the state of the StockDistributor object is active, continue the following CORBA::Object_var obj = orb_->resolve_initial_references ("RTCurrent"); RTCORBA::Current_var rt_current = RTCORBA::Current::_narrow (obj); - + rt_current->the_priority (iter->second.second); // Tell the database to push its information to the // <consumer>, which passes along the CORBA priority - // in the service_context list of the GIOP message. + // in the service_context list of the GIOP message. STOCK_DATABASE->publish_stock_info (iter->second.first); } catch (CORBA::Exception &ex) @@ -288,10 +288,10 @@ While the state of the StockDistributor object is active, continue the following <li>Deactivate the StockDistributor object.</li> -<PRE> +<PRE> ::Stock::StockDistributor_var dist = this->_this (); PortableServer::ObjectId_var oid = this->rt_poa_->reference_to_id (dist.in ()); - + this->rt_poa_->deactivate_object (oid.in ()); </PRE> diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc index 0c7770da4e6..910ccb62870 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc +++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc @@ -21,7 +21,6 @@ project(ImR_Locator_IDL) : orbsvcslib, orbsvcs_output, conv_lib, valuetype, port after += ImR_Activator_IDL libs += TAO_ImR_Activator_IDL // Dont try to build this project if ImR_Activator_IDL is not built - requires += corba_messaging dynamicflags += LOCATOR_IDL_BUILD_DLL idlflags += -Wb,export_macro=LocatorIDL_Export -Wb,export_include=locator_idl_export.h @@ -51,7 +50,6 @@ project(ImR_Activator) : orbsvcslib, orbsvcs_output, conv_lib, acexml, avoids_mi after += ImR_Activator_IDL ImR_Locator_IDL libs += TAO_ImR_Activator_IDL TAO_ImR_Locator_IDL // Dont try to build this project if ImR_Activator_IDL is not built - requires += corba_messaging Source_Files { ImR_Activator_i.cpp diff --git a/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc b/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc index 2671b2a5ed7..281f4775ed1 100644 --- a/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc +++ b/TAO/orbsvcs/examples/RtEC/IIOPGateway/RtEC_IIOPGateway.mpc @@ -2,44 +2,28 @@ // $Id$ project(*Consumer): messaging, rteventexe, naming { - exename = Consumer - - requires += corba_messaging - Source_Files { Consumer.cpp } } project(*Supplier): messaging, rteventexe, naming { - exename = Supplier - - requires += corba_messaging - Source_Files { Supplier.cpp } } project(*): messaging, rteventexe, rtevent_serv, naming { - exename = Gateway - - requires += corba_messaging - Source_Files { Gateway.cpp } } project(*EC): messaging, rteventexe, rtevent_serv, naming { - exename = EC - - requires += corba_messaging - Source_Files { EC.cpp } diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp index 95841b71732..c99dbc35ce9 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.cpp @@ -380,7 +380,7 @@ TAO_CEC_TypedProxyPushConsumer_Guard:: return; this->locked_ = 1; - this->refcount_++; + ++this->refcount_; } TAO_CEC_TypedProxyPushConsumer_Guard:: diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h index 547df4ccbfd..31720a9b33e 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_TypedProxyPushConsumer.h @@ -146,7 +146,7 @@ private: * @brief A Guard for the TypedProxyPushConsumer reference count * * This is a helper class used in the implementation of - * TypedProxyPushConumer. It provides a Guard mechanism to increment + * TypedProxyPushConsumer. It provides a Guard mechanism to increment * the reference count on the proxy, eliminating the need to hold * mutexes during long operations. */ diff --git a/TAO/orbsvcs/tests/Miop/McastHello/client.cpp b/TAO/orbsvcs/tests/Miop/McastHello/client.cpp index a84044b4085..38b253edba4 100644 --- a/TAO/orbsvcs/tests/Miop/McastHello/client.cpp +++ b/TAO/orbsvcs/tests/Miop/McastHello/client.cpp @@ -56,9 +56,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) */ Test::McastHello_var hello = TAO::Narrow_Utils<Test::McastHello>::unchecked_narrow ( - tmp.in (), - Test__TAO_McastHello_Proxy_Broker_Factory_function_pointer - ); + tmp.in ()); if (CORBA::is_nil (hello.in ())) { diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp index 6891dcd7cd1..bb111e54370 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp @@ -328,6 +328,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return client.check_results (); + int status = 0; + + try + { + status = client.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp index 5ec7883937c..779bde188e6 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp @@ -313,5 +313,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp index 382a27887f1..1db133780ce 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp @@ -354,5 +354,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return client.check_results (); + int status = 0; + + try + { + status = client.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp index 6b345e31871..9d4b0f3768b 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp @@ -349,5 +349,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp index 5cc9b2df6ec..c27af8a8979 100644 --- a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp +++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp @@ -231,5 +231,17 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } - return events.check_results (); + int status = 0; + + try + { + status = events.check_results (); + } + catch (const CORBA::Exception& se) + { + se._tao_print_exception ("Error: "); + status = 1; + } + + return status; } diff --git a/TAO/performance-tests/Anyop/anyop.cpp b/TAO/performance-tests/Anyop/anyop.cpp index fd82626063f..afaa7e0cf1c 100644 --- a/TAO/performance-tests/Anyop/anyop.cpp +++ b/TAO/performance-tests/Anyop/anyop.cpp @@ -83,8 +83,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:1234/Foo/Bar"); Param_Test_var param_test = - TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in (), - 0); + TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in ()); TAO_Stub *stub = param_test->_stubobj (); stub->type_id = CORBA::string_dup ("IDL:Param_Test:1.0"); diff --git a/TAO/performance-tests/Throughput/Receiver_Factory.h b/TAO/performance-tests/Throughput/Receiver_Factory.h index ea8ec3ff2a9..4ccf75b421b 100644 --- a/TAO/performance-tests/Throughput/Receiver_Factory.h +++ b/TAO/performance-tests/Throughput/Receiver_Factory.h @@ -8,11 +8,6 @@ #include "TestS.h" -#if defined (_MSC_VER) -# pragma warning(push) -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - /// Implement the Test::Receiver_Factory interface class Receiver_Factory : public virtual POA_Test::Receiver_Factory @@ -31,9 +26,5 @@ private: CORBA::ORB_var orb_; }; -#if defined(_MSC_VER) -# pragma warning(pop) -#endif /* _MSC_VER */ - #include /**/ "ace/post.h" #endif /* THROUGHPUT_RECEIVER_FACTORY_H */ diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index a41fe1bec54..fcd601e961b 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -61,9 +61,7 @@ typedef void (*TAO_Skeleton)( typedef void (*TAO_Collocated_Skeleton)( TAO_Abstract_ServantBase *, - TAO::Argument **, - int - ); + TAO::Argument **); class TAO_Export TAO_Abstract_ServantBase { @@ -125,6 +123,15 @@ public: TAO::Collocation_Strategy s, const size_t length = 0) = 0; + virtual void _collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy) = 0; + protected: /// Default constructor, only derived classes can be created. diff --git a/TAO/tao/AnyTypeCode/Any_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Impl.cpp index bc5273c536b..6bf1047c835 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl.cpp @@ -103,8 +103,7 @@ TAO::Any_Impl::_remove_ref (void) } void -TAO::Any_Impl::_tao_decode (TAO_InputCDR & - ) +TAO::Any_Impl::_tao_decode (TAO_InputCDR &) { throw ::CORBA::NO_IMPLEMENT (); } diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index dc9ccc4cb57..668d4b7b557 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -219,8 +219,7 @@ TAO_OutputCDR::throw_skel_exception (int error_num ) ACE_NOTREACHED (break); case EACCES : // wchar but no codeset - throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 23, - CORBA::COMPLETED_YES); + throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 23, CORBA::COMPLETED_YES); ACE_NOTREACHED (break); #if (ERANGE != EINVAL) diff --git a/TAO/tao/CORBANAME_Parser.cpp b/TAO/tao/CORBANAME_Parser.cpp index f9a7fe1a5c8..0f7adf72a1a 100644 --- a/TAO/tao/CORBANAME_Parser.cpp +++ b/TAO/tao/CORBANAME_Parser.cpp @@ -51,7 +51,7 @@ parse_string_dynamic_request_helper (CORBA::Object_ptr naming_context, 2, "resolve_str", 11, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); tao_call.invoke (0, 0); diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp index 657dc7e38bc..0b338b2d60a 100644 --- a/TAO/tao/Collocated_Invocation.cpp +++ b/TAO/tao/Collocated_Invocation.cpp @@ -1,7 +1,6 @@ // $Id$ #include "tao/Collocated_Invocation.h" -#include "tao/Collocation_Proxy_Broker.h" #include "tao/ORB_Core.h" #include "tao/Request_Dispatcher.h" #include "tao/TAO_Server_Request.h" @@ -9,6 +8,7 @@ #include "tao/operation_details.h" #include "tao/PortableInterceptor.h" #include "tao/SystemException.h" +#include "tao/Abstract_Servant_Base.h" #if TAO_HAS_INTERCEPTORS == 1 # include "tao/PortableInterceptorC.h" @@ -33,8 +33,7 @@ namespace TAO } Invocation_Status - Collocated_Invocation::invoke (Collocation_Proxy_Broker *cpb, - Collocation_Strategy strat) + Collocated_Invocation::invoke (Collocation_Strategy strat) { Invocation_Status s = TAO_INVOKE_FAILURE; @@ -82,7 +81,8 @@ namespace TAO { bool is_forwarded = false; - cpb->dispatch (this->effective_target (), + this->effective_target ()->_servant()->_collocated_dispatch ( + this->effective_target (), this->forwarded_to_.out (), is_forwarded, this->details_.args (), diff --git a/TAO/tao/Collocated_Invocation.h b/TAO/tao/Collocated_Invocation.h index cdca74f975b..d86cd1bca01 100644 --- a/TAO/tao/Collocated_Invocation.h +++ b/TAO/tao/Collocated_Invocation.h @@ -83,8 +83,7 @@ namespace TAO * servant. * */ - Invocation_Status invoke (Collocation_Proxy_Broker *cpb, - Collocation_Strategy strat); + Invocation_Status invoke (Collocation_Strategy strat); private: diff --git a/TAO/tao/Collocation_Proxy_Broker.cpp b/TAO/tao/Collocation_Proxy_Broker.cpp deleted file mode 100644 index ea46473b3ee..00000000000 --- a/TAO/tao/Collocation_Proxy_Broker.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// $Id$ - -#include "tao/Collocation_Proxy_Broker.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO::Collocation_Proxy_Broker::~Collocation_Proxy_Broker (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Collocation_Proxy_Broker.h b/TAO/tao/Collocation_Proxy_Broker.h deleted file mode 100644 index efc8465db89..00000000000 --- a/TAO/tao/Collocation_Proxy_Broker.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Collocation_Proxy_Broker.h - * - * $Id$ - * - * - * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef TAO_COLLOCATION_PROXY_BROKER_H -#define TAO_COLLOCATION_PROXY_BROKER_H - -#include /**/ "ace/pre.h" - -#include /**/ "tao/TAO_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Collocation_Strategy.h" -#include /**/ "tao/Versioned_Namespace.h" - -#include "ace/os_include/os_stddef.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<typename T> class TAO_Pseudo_Var_T; -template<typename T> class TAO_Pseudo_Out_T; - -namespace CORBA -{ - class Object; - typedef Object *Object_ptr; - typedef TAO_Pseudo_Var_T<Object> Object_var; - typedef TAO_Pseudo_Out_T<Object> Object_out; -} - -namespace TAO -{ - class Argument; - - /** - * @class Collocation_Proxy_Broker - */ - class TAO_Export Collocation_Proxy_Broker - { - - public: - virtual ~Collocation_Proxy_Broker (void); - - virtual Collocation_Strategy get_strategy (CORBA::Object_ptr obj) = 0; - - virtual void dispatch (CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - Argument ** args, - int num_args, - const char * op, - size_t op_len, - Collocation_Strategy strategy) = 0; - }; - -TAO_END_VERSIONED_NAMESPACE_DECL -} - -#include /**/ "ace/post.h" - -#endif /*TAO_COLLOCATION_PROXY_BROKER_H */ diff --git a/TAO/tao/Collocation_Strategy.h b/TAO/tao/Collocation_Strategy.h index 2a9e8c0aeaa..00e4050b5b5 100644 --- a/TAO/tao/Collocation_Strategy.h +++ b/TAO/tao/Collocation_Strategy.h @@ -19,7 +19,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -/// Define symbolic names for the ORB collocation strategies. +/// Define symbolic names for the ORB collocation strategies as used at runtime. namespace TAO { enum Collocation_Strategy @@ -39,6 +39,29 @@ namespace TAO /// strategies. TAO_CS_LAST }; + + inline const char * translate_collocation_strategy (Collocation_Strategy cs) + { +#define TAO_CS(X) case X: return #X + switch (cs) + { + TAO_CS (TAO_CS_REMOTE_STRATEGY); + TAO_CS (TAO_CS_THRU_POA_STRATEGY); + TAO_CS (TAO_CS_DIRECT_STRATEGY); + TAO_CS (TAO_CS_LAST); + } + return "***Unknown enum value, update TAO::translate_collocation_strategy()"; +#undef TAO_CS + } + + /// No collocation possible + int const TAO_CO_NONE = 0x00; + + /// Through POA collocation is possible + int const TAO_CO_THRU_POA_STRATEGY = 0x01; + + /// Direct collocation is possible + int const TAO_CO_DIRECT_STRATEGY = 0x02; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index 8410e8eb9ea..e302ccaff0f 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -36,7 +36,7 @@ namespace TAO arg_number, operation, op_len, - 0, // Collocation Proxy broker pointer + TAO_CO_THRU_POA_STRATEGY, // default through POA collocation is possible TAO_TWOWAY_INVOCATION, mode) , exception_list_ (excp) @@ -158,7 +158,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO_ORB_Core *oc, CORBA::Request *req, Invocation_Mode mode) @@ -167,7 +167,7 @@ namespace TAO arg_number, operation, op_len, - b, + collocation_opportunity, TAO_TWOWAY_INVOCATION, mode) , request_ (req) @@ -305,7 +305,7 @@ namespace TAO arg_count, operation, op_len, - 0, + TAO_CO_THRU_POA_STRATEGY, TAO_ONEWAY_INVOCATION, mode) { diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h index f058c2b97c0..80b2c6f9274 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h @@ -141,7 +141,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO_ORB_Core *oc, CORBA::Request *req, TAO::Invocation_Mode mode = TAO_DII_DEFERRED_INVOCATION); diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 716376bb0d2..d28b2e87873 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -151,31 +151,31 @@ TAO_IIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint) if (iiop_endpoint == 0) return -1; - const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); + const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); - // Verify that the remote ACE_INET_Addr was initialized properly. - // Failure can occur if hostname lookup failed when initializing the - // remote ACE_INET_Addr. + // Verify that the remote ACE_INET_Addr was initialized properly. + // Failure can occur if hostname lookup failed when initializing the + // remote ACE_INET_Addr. #if defined (ACE_HAS_IPV6) - if (remote_address.get_type () != AF_INET && - remote_address.get_type () != AF_INET6) + if (remote_address.get_type () != AF_INET && + remote_address.get_type () != AF_INET6) #else /* ACE_HAS_IPV6 */ - if (remote_address.get_type () != AF_INET) + if (remote_address.get_type () != AF_INET) #endif /* !ACE_HAS_IPV6 */ - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - IIOP connection failed.\n") - ACE_TEXT (" This is most likely ") - ACE_TEXT ("due to a hostname lookup ") - ACE_TEXT ("failure.\n"))); - } - - return -1; - } - - return 0; + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - IIOP connection failed.\n") + ACE_TEXT (" This is most likely ") + ACE_TEXT ("due to a hostname lookup ") + ACE_TEXT ("failure.\n"))); + } + + return -1; + } + + return 0; } TAO_Transport * diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index 0359a3efb57..f85187b0172 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -11,10 +11,10 @@ #include "tao/Collocated_Invocation.h" #include "tao/Transport.h" #include "tao/Transport_Mux_Strategy.h" -#include "tao/Collocation_Proxy_Broker.h" #include "tao/GIOP_Utils.h" #include "tao/TAOC.h" #include "tao/SystemException.h" +#include "tao/Collocation_Resolver.h" #include "ace/Service_Config.h" #if !defined (__ACE_INLINE__) @@ -74,13 +74,19 @@ namespace TAO // Default we go to remote Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY; - // If we have a collocated proxy broker we look if we maybe + // If we have the opportunity for collocation we maybe // can use a collocated invocation. Similarly, if the // target object reference contains a pointer to a servant, // the object reference also refers to a collocated object. - if (cpb_ != 0 || effective_target->_servant () != 0) + // get the ORBStrategy + strat = this->collocation_strategy (effective_target.in ()); + + if (TAO_debug_level > 2) { - strat = TAO_ORB_Core::collocation_strategy (effective_target.in ()); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Invocation_Adapter::invoke_i, ") + ACE_TEXT("making a %C invocation\n"), + TAO::translate_collocation_strategy(strat))); } if (strat == TAO_CS_REMOTE_STRATEGY || strat == TAO_CS_LAST) @@ -104,7 +110,6 @@ namespace TAO effective_target, strat); } - if (status == TAO_INVOKE_RESTART) { details.reset_request_service_info (); @@ -135,11 +140,20 @@ namespace TAO TAO_Stub * const stub = this->target_->_stubobj (); if (stub == 0) - throw ::CORBA::INTERNAL ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - EINVAL), - CORBA::COMPLETED_NO); + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::get_stub, ") + ACE_TEXT ("raising CORBA::INTERNAL because of nil ") + ACE_TEXT ("stub.\n"))); + } + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } return stub; } @@ -150,12 +164,6 @@ namespace TAO CORBA::Object_var &effective_target, Collocation_Strategy strat) { - // To make a collocated call we must have a collocated proxy broker, the - // invoke_i() will make sure that we only come here when we have one - ACE_ASSERT (cpb_ != 0 - || (strat == TAO_CS_THRU_POA_STRATEGY - && effective_target->_servant () != 0)); - // Initial state TAO::Invocation_Status status = TAO_INVOKE_START; @@ -165,7 +173,7 @@ namespace TAO details, this->type_ == TAO_TWOWAY_INVOCATION); - status = coll_inv.invoke (this->cpb_, strat); + status = coll_inv.invoke (strat); if (status == TAO_INVOKE_RESTART && (coll_inv.reply_status () == GIOP::LOCATION_FORWARD || @@ -228,14 +236,12 @@ namespace TAO bool const block_connect = rflags != static_cast<CORBA::Octet> (Messaging::SYNC_NONE) && rflags != static_cast<CORBA::Octet> (TAO::SYNC_DELAYED_BUFFERING); - // Create the resolver which will pick (or create) for us a // transport and a profile from the effective_target. Profile_Transport_Resolver resolver ( effective_target.in (), stub, block_connect); - resolver.resolve (max_wait_time); if (TAO_debug_level) @@ -245,13 +251,11 @@ namespace TAO ACE_TEXT ("TAO (%P|%t) - Invocation_Adapter::invoke_remote_i, ") ACE_TEXT ("max wait time consumed during transport resolution\n"))); } - // Update the request id now that we have a transport if (resolver.transport ()) { details.request_id (resolver.transport ()->tms ()->request_id ()); } - switch (this->type_) { case TAO_ONEWAY_INVOCATION: @@ -382,6 +386,100 @@ namespace TAO errno), CORBA::COMPLETED_NO); } + + TAO::Collocation_Strategy + Invocation_Adapter::collocation_strategy (CORBA::Object_ptr object) + { + TAO::Collocation_Strategy strategy = TAO::TAO_CS_REMOTE_STRATEGY; + TAO_Stub *stub = object->_stubobj (); + if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && + stub->servant_orb_var ()->orb_core () != 0) + { + TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core (); + + if (orb_core->collocation_resolver ().is_collocated (object)) + { + switch (orb_core->get_collocation_strategy ()) + { + case TAO_ORB_Core::TAO_COLLOCATION_THRU_POA: + { + // check opportunity + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_THRU_POA_STRATEGY)) + { + strategy = TAO::TAO_CS_THRU_POA_STRATEGY; + } + else + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::collocation_strategy, ") + ACE_TEXT ("request for through poa collocation ") + ACE_TEXT ("without needed collocation opportunity.\n"))); + } + // collocation object, but no collocation_opportunity for Thru_poa + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } + break; + } + case TAO_ORB_Core::TAO_COLLOCATION_DIRECT: + { + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_DIRECT_STRATEGY) + && (object->_servant () != 0)) + { + strategy = TAO::TAO_CS_DIRECT_STRATEGY; + } + else + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Invocation_Adapter::collocation_strategy, ") + ACE_TEXT ("request for direct collocation ") + ACE_TEXT ("without needed collocation opportunity.\n"))); + } + // collocation object, but no collocation_opportunity for Direct + // or servant() == 0 + throw ::CORBA::INTERNAL ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO); + } + break; + } + case TAO_ORB_Core::TAO_COLLOCATION_BEST: + { + if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_DIRECT_STRATEGY) + && (object->_servant () != 0)) + { + strategy = TAO::TAO_CS_DIRECT_STRATEGY; + } + else if (ACE_BIT_ENABLED (this->collocation_opportunity_, + TAO::TAO_CO_THRU_POA_STRATEGY)) + { + strategy = TAO::TAO_CS_THRU_POA_STRATEGY; + } + else + { + strategy = TAO::TAO_CS_REMOTE_STRATEGY; + } + break; + } + } + } + } + + return strategy; + } + } // End namespace TAO TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Invocation_Adapter.h b/TAO/tao/Invocation_Adapter.h index 958083c8945..f539c28de45 100644 --- a/TAO/tao/Invocation_Adapter.h +++ b/TAO/tao/Invocation_Adapter.h @@ -46,7 +46,6 @@ namespace TAO { class Argument; struct Exception_Data; - class Collocation_Proxy_Broker; class Profile_Transport_Resolver; /** @@ -94,9 +93,8 @@ namespace TAO * is an optimization which helps us to avoid calling strlen () * while creating a message format. * - * @param cpb The collocation proxy broker for the target if one - * exists. This is useful especially to route the call to the - * collocated target. + * @param collocation_opportunity Indicate which collocation optimizations + * should be possible * * @param type The operation type which could be a oneway or two * way operation. This information is available in the IDL file. @@ -109,7 +107,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *cpb, + int collocation_opportunity, TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); @@ -236,6 +234,16 @@ namespace TAO Invocation_Adapter (Invocation_Adapter const &); Invocation_Adapter & operator= (const Invocation_Adapter &); + /** + * This method returns the right collocation strategy, if any, + * to be used to perform a method invocation on the given object. + * + * @note + * No-Collocation is a special case of collocation. + */ + TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object); + //@} + protected: /// The target object on which this invocation is carried out. CORBA::Object_ptr target_; @@ -255,8 +263,8 @@ namespace TAO /// String length of the operation name. size_t const op_len_; - /// Collocation proxy broker for this operation. - Collocation_Proxy_Broker * const cpb_; + /// Collocation opportunity for this operation. + int const collocation_opportunity_; /// The invocation type Invocation_Type const type_; diff --git a/TAO/tao/Invocation_Adapter.inl b/TAO/tao/Invocation_Adapter.inl index 3ee1410310c..7acff3aa75a 100644 --- a/TAO/tao/Invocation_Adapter.inl +++ b/TAO/tao/Invocation_Adapter.inl @@ -13,7 +13,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Type type, Invocation_Mode mode) : target_ (target) @@ -21,7 +21,7 @@ namespace TAO , number_args_ (arg_number) , operation_ (operation) , op_len_ (op_len) - , cpb_ (p) + , collocation_opportunity_ (collocation_opportunity) , type_ (type) , mode_ (mode) { diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp index 9f12cff39d9..80600b7d718 100644 --- a/TAO/tao/LocalObject.cpp +++ b/TAO/tao/LocalObject.cpp @@ -77,6 +77,10 @@ CORBA::LocalObject::_non_existent (void) char * CORBA::LocalObject::_repository_id (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot get _repository_id from a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } @@ -89,6 +93,10 @@ CORBA::LocalObject::_create_request (CORBA::Context_ptr, CORBA::Request_ptr &, CORBA::Flags) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _create_request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } @@ -102,24 +110,40 @@ CORBA::LocalObject::_create_request (CORBA::Context_ptr, CORBA::Request_ptr &, CORBA::Flags) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _create_request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } CORBA::Request_ptr CORBA::LocalObject::_request (const char *) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _request for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4, CORBA::COMPLETED_NO); } CORBA::Object_ptr CORBA::LocalObject::_get_component (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_component for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::InterfaceDef_ptr CORBA::LocalObject::_get_interface (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_interface for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } #endif @@ -131,12 +155,20 @@ CORBA::LocalObject::_get_interface (void) CORBA::Policy_ptr CORBA::LocalObject::_get_policy (CORBA::PolicyType) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_policy for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::Policy_ptr CORBA::LocalObject::_get_cached_policy (TAO_Cached_Policy_Type) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_cached_policy for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (); } @@ -144,18 +176,30 @@ CORBA::Object_ptr CORBA::LocalObject::_set_policy_overrides (const CORBA::PolicyList &, CORBA::SetOverrideType) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _set_policy_overrides for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::PolicyList * CORBA::LocalObject::_get_policy_overrides (const CORBA::PolicyTypeSeq &) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_policy_overrides for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } CORBA::Boolean CORBA::LocalObject::_validate_connection (CORBA::PolicyList_out) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _validate_connection for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } @@ -164,6 +208,10 @@ CORBA::LocalObject::_validate_connection (CORBA::PolicyList_out) CORBA::ORB_ptr CORBA::LocalObject::_get_orb (void) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - Cannot call _get_orb for a LocalObject!\n"))); + throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp index 65036e25725..e0b8a583be7 100644 --- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp +++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp @@ -27,14 +27,14 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Mode m) : Invocation_Adapter (target, args, arg_number, operation, op_len, - p, + collocation_opportunity, TAO_TWOWAY_INVOCATION, m) , safe_rd_ () diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.h b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h index 4ac8cf80068..4c78afaedae 100644 --- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.h +++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h @@ -67,7 +67,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *b, + int collocation_opportunity, TAO::Invocation_Mode mode = TAO_ASYNCHRONOUS_CALLBACK_INVOCATION); void invoke (Messaging::ReplyHandler_ptr reply_handler_ptr, diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index e29612762e7..ff5063de97a 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -217,7 +217,7 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid, ft_send_extended_sc_ (false), opt_for_collocation_ (true), use_global_collocation_ (true), - collocation_strategy_ (THRU_POA), + collocation_strategy_ (TAO_DEFAULT_COLLOCATION_STRATEGY), #if (TAO_HAS_CORBA_MESSAGING == 1) @@ -439,7 +439,6 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) this->use_implrepo_ = ACE_OS::atoi (use_IMR_env_var_value) ; } - while (arg_shifter.is_anything_left ()) { const ACE_TCHAR *current_arg = 0; @@ -613,9 +612,17 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) // Specify which collocation policy we want to use. const ACE_TCHAR *opt = current_arg; if (ACE_OS::strcasecmp (opt, ACE_TEXT("thru_poa")) == 0) - this->collocation_strategy_ = THRU_POA; + { + this->collocation_strategy_ = TAO_COLLOCATION_THRU_POA; + } else if (ACE_OS::strcasecmp (opt, ACE_TEXT("direct")) == 0) - this->collocation_strategy_ = DIRECT; + { + this->collocation_strategy_ = TAO_COLLOCATION_DIRECT; + } + else if (ACE_OS::strcasecmp (opt, ACE_TEXT("best")) == 0) + { + this->collocation_strategy_ = TAO_COLLOCATION_BEST; + } arg_shifter.consume_arg (); } @@ -3611,39 +3618,4 @@ TAO_ORB_Core_instance (void) return orb_table->first_orb (); } - -TAO::Collocation_Strategy -TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object) -{ - TAO_Stub *stub = object->_stubobj (); - if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && - stub->servant_orb_var ()->orb_core () != 0) - { - TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core (); - - if (orb_core->collocation_resolver ().is_collocated (object)) - { - switch (orb_core->get_collocation_strategy ()) - { - case THRU_POA: - return TAO::TAO_CS_THRU_POA_STRATEGY; - - case DIRECT: - { - ///////////////////////////////////////////////////////////// - // If the servant is null and you are collocated this means - // that the POA policy NON-RETAIN is set, and with that policy - // using the DIRECT collocation strategy is just insane. - ///////////////////////////////////////////////////////////// - ACE_ASSERT (object->_servant () != 0); - return TAO::TAO_CS_DIRECT_STRATEGY; - } - } - } - } - - // In this case the Object is a client. - return TAO::TAO_CS_REMOTE_STRATEGY; -} - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 136d43e24d8..085522ec1a8 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -225,7 +225,7 @@ public: /// Get the adapter registry TAO_Adapter_Registry &adapter_registry (void); - /// @name Collocation Strategies + /// @name Collocation Strategies as configured by the user //@{ enum { @@ -234,22 +234,16 @@ public: ORB_CONTROL, /// Collocated calls will go thru POA. - THRU_POA, + TAO_COLLOCATION_THRU_POA, /// Collocated calls invoke operation on Servant directly. - DIRECT - }; + TAO_COLLOCATION_DIRECT, - /** - * This method returns the right collocation strategy, if any, - * to be used to perform a method invocation on the given object. - * - * @note - * No-Collocation is a special case of collocation. - */ - static - TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object); - //@} + /// Collocated calls invoke operation on Servant directly if possible, + /// else Collocated calls will go thru POA if possible, else + /// use REMOTE_STRATEGY + TAO_COLLOCATION_BEST + }; /// Set/get the collocation flags //@{ diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 8b8ed8d7fdb..55ea29155a8 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -209,7 +209,14 @@ CORBA::Object::_is_a (const char *type_id) // XXX if type_id is that of CORBA::Object, "yes, we comply" :-) if (this->protocol_proxy_ == 0) - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + type_id)); + + throw ::CORBA::NO_IMPLEMENT (); + } if (this->_stubobj ()->type_id.in () != 0 && ACE_OS::strcmp (type_id, @@ -236,13 +243,6 @@ CORBA::Object::_is_collocated (void) const return false; } -void -CORBA::Object::set_collocated_servant (TAO_Abstract_ServantBase *b) -{ - this->protocol_proxy_->collocated_servant (b); - this->protocol_proxy_->is_collocated (true); -} - CORBA::Boolean CORBA::Object::_is_local (void) const { @@ -374,6 +374,11 @@ CORBA::Object::_create_request (CORBA::Context_ptr ctx, // object references. if (ctx != 0 || this->protocol_proxy_ == 0) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } @@ -414,6 +419,11 @@ CORBA::Object::_create_request (CORBA::Context_ptr ctx, // object references. if (ctx != 0 || this->protocol_proxy_ == 0) { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } @@ -452,6 +462,11 @@ CORBA::Object::_request (const char *operation) } else { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy for %C\n"), + operation)); + throw ::CORBA::NO_IMPLEMENT (); } } @@ -522,7 +537,13 @@ CORBA::Object::_get_policy (CORBA::PolicyType type) if (this->protocol_proxy_) return this->protocol_proxy_->get_policy (type); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Policy_ptr @@ -533,7 +554,13 @@ CORBA::Object::_get_cached_policy (TAO_Cached_Policy_Type type) if (this->protocol_proxy_) return this->protocol_proxy_->get_cached_policy (type); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Object_ptr @@ -544,7 +571,13 @@ CORBA::Object::_set_policy_overrides ( TAO_OBJECT_IOR_EVALUATE_RETURN; if (!this->protocol_proxy_) - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } TAO_Stub* stub = this->protocol_proxy_->set_policy_overrides (policies, set_add); @@ -581,7 +614,13 @@ CORBA::Object::_get_policy_overrides (const CORBA::PolicyTypeSeq & types) if (this->protocol_proxy_) return this->protocol_proxy_->get_policy_overrides (types); else - throw ::CORBA::NO_IMPLEMENT (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } CORBA::Boolean @@ -634,7 +673,13 @@ CORBA::Object::_get_orb (void) if (this->protocol_proxy_) return CORBA::ORB::_duplicate (this->protocol_proxy_->orb_core ()->orb ()); else - throw ::CORBA::INTERNAL (); + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - No protocol proxy in _get_policy\n"))); + + throw ::CORBA::NO_IMPLEMENT (); + } } } diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index 932cff0dfc7..59ae911e3e0 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -306,15 +306,6 @@ namespace CORBA /// Accessor to the flag.. CORBA::Boolean is_evaluated (void) const; - /// Mutator for setting the servant in collocated cases. - /** - * This is used by the Object_Adapter to set the servant for - * collocated cases and only when the object is initialized. The - * object initialization takes place when IOR's are lazily - * evaluated. - */ - void set_collocated_servant (TAO_Abstract_ServantBase *); - /// Accessor for the ORB_Core.. TAO_ORB_Core *orb_core (void) const; @@ -339,8 +330,7 @@ namespace CORBA virtual char* convert_to_ior (bool use_omg_ior_format, const char* ior_prefix) const; - /// Wrapper for _remove_ref(), naming convention for - /// templatizing. + /// Wrapper for _remove_ref(), naming convention for templatizing. void _decr_refcount (void); protected: diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp index e48f0a5287c..17abfa18791 100644 --- a/TAO/tao/Object_T.cpp +++ b/TAO/tao/Object_T.cpp @@ -16,44 +16,23 @@ namespace TAO template<typename T> T * Narrow_Utils<T>::narrow (CORBA::Object_ptr obj, - const char *repo_id, - Proxy_Broker_Factory pbf) + const char *repo_id) { if (CORBA::is_nil (obj)) { return T::_nil (); } - if (obj->_is_a (repo_id) == false) + if (!obj->_is_a (repo_id)) { return T::_nil (); } - return TAO::Narrow_Utils<T>::unchecked_narrow (obj, repo_id, pbf); + return TAO::Narrow_Utils<T>::unchecked_narrow (obj); } template<typename T> T * - Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, - Proxy_Broker_Factory pbf) - { - T *proxy = 0; - try - { - proxy = TAO::Narrow_Utils<T>::unchecked_narrow (obj, 0, pbf); - } - catch (const ::CORBA::Exception&) - { - // Swallow the exception - return T::_nil (); - } - - return proxy; - } - - template<typename T> T * - Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, - const char *, - Proxy_Broker_Factory pbf) + Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj) { if (CORBA::is_nil (obj)) { @@ -65,34 +44,38 @@ namespace TAO return T::_duplicate (dynamic_cast<T *> (obj)); } - T_ptr proxy = Narrow_Utils<T>::lazy_evaluation (obj); - - if (!CORBA::is_nil (proxy)) + T_ptr proxy = T::_nil (); + try { - return proxy; + proxy = Narrow_Utils<T>::lazy_evaluation (obj); + + if (CORBA::is_nil (proxy)) + { + TAO_Stub* stub = obj->_stubobj (); + + if (stub != 0) + { + stub->_incr_refcnt (); + + bool const collocated = + !CORBA::is_nil (stub->servant_orb_var ().in ()) + && stub->optimize_collocation_objects () + && obj->_is_collocated (); + + ACE_NEW_RETURN (proxy, + T (stub, + collocated, + obj->_servant ()), + T::_nil ()); + } + } } - - TAO_Stub* stub = obj->_stubobj (); - - if (stub == 0) + catch (const ::CORBA::Exception&) { - // If we're here, we have been passed a bogus objref. - throw ::CORBA::BAD_PARAM (); + // Swallow the exception + return T::_nil (); } - stub->_incr_refcnt (); - - bool const collocated = - !CORBA::is_nil (stub->servant_orb_var ().in ()) - && stub->optimize_collocation_objects () - && obj->_is_collocated () - && pbf != 0; - - ACE_NEW_THROW_EX (proxy, - T (stub, - collocated, - obj->_servant ()), - CORBA::NO_MEMORY ()); return proxy; } diff --git a/TAO/tao/Object_T.h b/TAO/tao/Object_T.h index 0016da30550..cf8e24f9e7b 100644 --- a/TAO/tao/Object_T.h +++ b/TAO/tao/Object_T.h @@ -24,6 +24,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include /**/ "tao/Versioned_Namespace.h" +#include "tao/Collocation_Strategy.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -35,11 +36,6 @@ namespace CORBA namespace TAO { - class Collocation_Proxy_Broker; - - typedef - Collocation_Proxy_Broker * (* Proxy_Broker_Factory)(CORBA::Object_ptr); - template<typename T> class Narrow_Utils { @@ -47,15 +43,10 @@ namespace TAO typedef T *T_ptr; static T_ptr narrow (CORBA::Object_ptr, - const char *repo_id, - Proxy_Broker_Factory); + const char *repo_id); /// Version used the operators. - static T_ptr unchecked_narrow (CORBA::Object_ptr, Proxy_Broker_Factory); - - static T_ptr unchecked_narrow (CORBA::Object_ptr, - const char *repo_id, - Proxy_Broker_Factory); + static T_ptr unchecked_narrow (CORBA::Object_ptr); private: // Code for lazily evaluated IORs. diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp index 604ac00ebcc..58b400fc979 100644 --- a/TAO/tao/PolicyC.cpp +++ b/TAO/tao/PolicyC.cpp @@ -368,12 +368,6 @@ TAO::Objref_Traits<CORBA::Policy>::marshal ( return CORBA::Object::marshal (p, cdr); } -// Function pointer for collocation factory initialization. -TAO::Collocation_Proxy_Broker * -(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) ( - CORBA::Object_ptr obj - ) = 0; - // TAO_IDL - Generated from // be\be_visitor_operation/operation_cs.cpp:78 @@ -386,11 +380,6 @@ CORBA::PolicyType CORBA::Policy::policy_type ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -404,7 +393,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( 1, "_get_policy_type", 16, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); @@ -424,11 +413,6 @@ CORBA::PolicyType CORBA::Policy::policy_type ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< ::CORBA::Policy>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -442,7 +426,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( 1, "copy", 4, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); @@ -462,11 +446,6 @@ void CORBA::Policy::destroy ( ::CORBA::Object::tao_object_initialize (this); } - if (this->the_TAO_Policy_Proxy_Broker_ == 0) - { - CORBA_Policy_setup_collocation (); - } - TAO::Arg_Traits< void>::ret_val _tao_retval; TAO::Argument *_the_tao_operation_signature [] = @@ -480,26 +459,14 @@ void CORBA::Policy::destroy ( 1, "destroy", 7, - this->the_TAO_Policy_Proxy_Broker_ + TAO::TAO_CO_NONE | TAO::TAO_CO_DIRECT_STRATEGY | TAO::TAO_CO_THRU_POA_STRATEGY ); _tao_call.invoke (0, 0); } CORBA::Policy::Policy (void) - : the_TAO_Policy_Proxy_Broker_ (0) -{ - this->CORBA_Policy_setup_collocation (); -} - -void -CORBA::Policy::CORBA_Policy_setup_collocation () { - if (::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) - { - this->the_TAO_Policy_Proxy_Broker_ = - ::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer (this); - } } CORBA::Policy::~Policy (void) @@ -514,33 +481,19 @@ CORBA::Policy::_tao_any_destructor (void *_tao_void_pointer) } CORBA::Policy_ptr -CORBA::Policy::_narrow ( - CORBA::Object_ptr _tao_objref - - ) +CORBA::Policy::_narrow (CORBA::Object_ptr _tao_objref) { return TAO::Narrow_Utils<Policy>::narrow ( _tao_objref, - "IDL:omg.org/CORBA/Policy:1.0", - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - - ); + "IDL:omg.org/CORBA/Policy:1.0"); } CORBA::Policy_ptr -CORBA::Policy::_unchecked_narrow ( - CORBA::Object_ptr _tao_objref - - ) +CORBA::Policy::_unchecked_narrow (CORBA::Object_ptr _tao_objref) { return - TAO::Narrow_Utils<Policy>::unchecked_narrow ( - _tao_objref, - "IDL:omg.org/CORBA/Policy:1.0", - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - - ); + TAO::Narrow_Utils<Policy>::unchecked_narrow (_tao_objref); } CORBA::Policy_ptr @@ -722,9 +675,7 @@ CORBA::Boolean operator>> ( // Narrow to the right type. _tao_objref = TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow ( - obj.in (), - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - ); + obj.in ()); return 1; } diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index dc478cbae50..c37bfeb1cfd 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -67,7 +67,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - class Collocation_Proxy_Broker; template<typename T> class Narrow_Utils; } @@ -314,17 +313,10 @@ namespace CORBA virtual TAO_Policy_Scope _tao_scope (void) const; // **************************************************************** - private: - TAO::Collocation_Proxy_Broker *the_TAO_Policy_Proxy_Broker_; - protected: // Concrete interface only. Policy (void); - // These methods travese the inheritance tree and set the - // parents piece of the given class in the right mode. - virtual void CORBA_Policy_setup_collocation (void); - // Concrete non-local interface only. Policy ( IOP::IOR *ior, @@ -355,17 +347,6 @@ namespace CORBA } // module CORBA -// Proxy Broker Factory function pointer declarations. - -// TAO_IDL - Generated from -// be\be_visitor_root/root.cpp:139 - -extern TAO_Export -TAO::Collocation_Proxy_Broker * -(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) ( - CORBA::Object_ptr obj - ); - // TAO_IDL - Generated from // be\be_visitor_traits.cpp:61 diff --git a/TAO/tao/PolicyC.inl b/TAO/tao/PolicyC.inl index f9aac3d9fae..05a60494650 100644 --- a/TAO/tao/PolicyC.inl +++ b/TAO/tao/PolicyC.inl @@ -39,21 +39,16 @@ CORBA::Policy::Policy ( TAO_Stub *objref, CORBA::Boolean _tao_collocated, TAO_Abstract_ServantBase *servant, - TAO_ORB_Core *oc - ) - : ::CORBA::Object (objref, _tao_collocated, servant, oc), - the_TAO_Policy_Proxy_Broker_ (0) + TAO_ORB_Core *oc) + : ::CORBA::Object (objref, _tao_collocated, servant, oc) { - this->CORBA_Policy_setup_collocation (); } ACE_INLINE CORBA::Policy::Policy ( IOP::IOR *ior, - TAO_ORB_Core *oc - ) - : ::CORBA::Object (ior, oc), - the_TAO_Policy_Proxy_Broker_ (0) + TAO_ORB_Core *oc) + : ::CORBA::Object (ior, oc) { } diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp index c045934fa59..b6a94a51993 100644 --- a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp +++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp @@ -21,21 +21,21 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core ()->get_collocation_strategy () - == TAO_ORB_Core::THRU_POA) + == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); - CORBA::Object_var forward_to; - servant_upcall.prepare_for_upcall ( - stub->profile_in_use ()->object_key (), - "_is_a", - forward_to.out ()); + CORBA::Object_var forward_to; + servant_upcall.prepare_for_upcall ( + stub->profile_in_use ()->object_key (), + "_is_a", + forward_to.out ()); - servant_upcall.pre_invoke_collocated_request (); + servant_upcall.pre_invoke_collocated_request (); - return servant_upcall.servant ()->_is_a (type_id); - } + return servant_upcall.servant ()->_is_a (type_id); + } // Direct collocation strategy is used. if (target->_servant () != 0) @@ -43,7 +43,7 @@ namespace TAO return target->_servant ()->_is_a (type_id); } - return 0; + return false; } #if (TAO_HAS_MINIMUM_CORBA == 0) @@ -59,7 +59,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); @@ -97,7 +97,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( target->_stubobj ()->servant_orb_var ()->orb_core ()); @@ -135,7 +135,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core () - ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + ->get_collocation_strategy () == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( stub->servant_orb_var ()->orb_core ()); @@ -174,7 +174,7 @@ namespace TAO // Which collocation strategy should we use? if (stub != 0 && stub->servant_orb_var ()->orb_core ()->get_collocation_strategy () - == TAO_ORB_Core::THRU_POA) + == TAO_ORB_Core::TAO_COLLOCATION_THRU_POA) { TAO::Portable_Server::Servant_Upcall servant_upcall ( target->_stubobj ()->servant_orb_var ()->orb_core ()); diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp index fea4bc90175..56e68d482d9 100644 --- a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp +++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp @@ -20,7 +20,7 @@ TAO::Direct_Collocation_Upcall_Wrapper::upcall ( CORBA::Object_out forward_obj, bool & is_forwarded, TAO::Argument ** args, - int num_args, + int, const char * op, size_t op_len, TAO::Collocation_Strategy strategy) @@ -38,7 +38,7 @@ TAO::Direct_Collocation_Upcall_Wrapper::upcall ( try { #endif /* TAO_HAS_MINIMUM_CORBA && !CORBA_E_COMPACT && !CORBA_E_MICRO*/ - collocated_skel (servant, args, num_args); + collocated_skel (servant, args); #if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) } catch (const ::PortableServer::ForwardRequest& forward_request) diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h index 02213483f81..9b8a6d02be2 100644 --- a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h +++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h @@ -51,7 +51,6 @@ namespace TAO class TAO_PortableServer_Export Direct_Collocation_Upcall_Wrapper { public: - /// Perform the upcall void upcall ( CORBA::Object_ptr obj, diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 8686ad9979d..3b4940e3f6f 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -514,7 +514,7 @@ TAO_Object_Adapter::locate_servant_i (const TAO::ObjectKey &key) this->locate_poa (key, id, poa); PortableServer::Servant servant = 0; - TAO_SERVANT_LOCATION servant_location = + TAO_SERVANT_LOCATION const servant_location = poa->locate_servant_i (id, servant); switch (servant_location) diff --git a/TAO/tao/PortableServer/Operation_Table.h b/TAO/tao/PortableServer/Operation_Table.h index 87b81a7dec7..9a11e5f1b5a 100644 --- a/TAO/tao/PortableServer/Operation_Table.h +++ b/TAO/tao/PortableServer/Operation_Table.h @@ -32,14 +32,11 @@ class TAO_Abstract_ServantBase; typedef void (*TAO_Skeleton)( TAO_ServerRequest &, void *, - void * - ); + void *); typedef void (*TAO_Collocated_Skeleton)( TAO_Abstract_ServantBase *, - TAO::Argument **, - int - ); + TAO::Argument **); /** * @struct TAO_operation_db_entry diff --git a/TAO/tao/PortableServer/PolicyS.cpp b/TAO/tao/PortableServer/PolicyS.cpp index b9bffd54bbe..6a533af379a 100644 --- a/TAO/tao/PortableServer/PolicyS.cpp +++ b/TAO/tao/PortableServer/PolicyS.cpp @@ -204,99 +204,6 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len } static TAO_CORBA_Policy_Perfect_Hash_OpTable tao_CORBA_Policy_optable; -/////////////////////////////////////////////////////////////////////// -// Strategized Proxy Broker Implementation -// - -// TAO_IDL - Generated from -// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40 - -// Factory function Implementation. -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker * -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker (void) -{ - static POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker - strategized_proxy_broker; - - return &strategized_proxy_broker; -} - -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::_TAO_Policy_Strategized_Proxy_Broker (void) -{ -} - -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::~_TAO_Policy_Strategized_Proxy_Broker (void) -{ -} - -TAO::Collocation_Strategy -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::get_strategy ( - CORBA::Object_ptr obj - - ) -{ - TAO::Collocation_Strategy strategy = - TAO_ORB_Core::collocation_strategy (obj); - - return strategy; -} - -void -POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::dispatch ( - CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - TAO::Argument ** args, - int num_args, - const char * op, - size_t op_len, - TAO::Collocation_Strategy strategy - - ) -{ - TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper; - collocation_upcall_wrapper.upcall ( - obj, - forward_obj, - is_forwarded, - args, - num_args, - op, - op_len, - strategy - ); -} - -// -// End Strategized Proxy Broker Implementation -/////////////////////////////////////////////////////////////////////// - -// TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:999 - -TAO::Collocation_Proxy_Broker * -CORBA__TAO_Policy_Proxy_Broker_Factory_function (CORBA::Object_ptr) -{ - return - ::POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker (); -} - -int -CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer (size_t) -{ - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer = - CORBA__TAO_Policy_Proxy_Broker_Factory_function; - - return 0; -} - -static int -CORBA__TAO_Policy_Proxy_Broker_Stub_Factory_Initializer_Scarecrow = - CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer ( - reinterpret_cast<size_t> (CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer) - ); - - /////////////////////////////////////////////////////////////////////// // Direct Proxy Implementation @@ -314,17 +221,12 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::~_TAO_Policy_Direct_Proxy_Impl (void) void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - - ) + TAO::Argument ** args) { ((TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val *) args[0])->arg () = dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->policy_type ( - - ); + ->policy_type (); } // TAO_IDL - Generated from // be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 @@ -332,17 +234,12 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - - ) + TAO::Argument ** args) { ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () = dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->copy ( - - ); + ->copy (); } // TAO_IDL - Generated from // be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 @@ -350,15 +247,11 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy ( TAO_Abstract_ServantBase *servant, - TAO::Argument **, - int - ) + TAO::Argument **) { dynamic_cast<POA_CORBA::Policy_ptr> (servant) - ->destroy ( - - ); + ->destroy (); } @@ -1026,9 +919,7 @@ POA_CORBA::Policy::_this (void) typedef ::CORBA::Policy STUB_SCOPED_NAME; return TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow ( - obj.in (), - CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer - ); + obj.in ()); } #endif /* ifndef */ diff --git a/TAO/tao/PortableServer/PolicyS.h b/TAO/tao/PortableServer/PolicyS.h index 44603b46599..fc076ae73b5 100644 --- a/TAO/tao/PortableServer/PolicyS.h +++ b/TAO/tao/PortableServer/PolicyS.h @@ -42,7 +42,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Collocation_Proxy_Broker.h" #include "tao/PortableServer/PortableServer.h" #include "tao/PortableServer/Servant_Base.h" @@ -73,9 +72,6 @@ namespace POA_CORBA class Policy; typedef Policy *Policy_ptr; - class _TAO_Policy_Direct_Proxy_Impl; - class _TAO_Policy_Strategized_Proxy_Broker; - class TAO_PortableServer_Export Policy : public virtual PortableServer::ServantBase { @@ -182,48 +178,6 @@ namespace POA_CORBA ); }; - /////////////////////////////////////////////////////////////////////// - // Strategized Proxy Broker Declaration - // - - // TAO_IDL - Generated from - // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36 - - class TAO_PortableServer_Export _TAO_Policy_Strategized_Proxy_Broker - : public virtual TAO::Collocation_Proxy_Broker - { - public: - _TAO_Policy_Strategized_Proxy_Broker (void); - - virtual ~_TAO_Policy_Strategized_Proxy_Broker (void); - - TAO::Collocation_Strategy - get_strategy ( - CORBA::Object_ptr obj - - ); - - void - dispatch ( - CORBA::Object_ptr obj, - CORBA::Object_out forward_obj, - bool & is_forwarded, - TAO::Argument ** args, - int num_args, - const char * op, - size_t op_len, - TAO::Collocation_Strategy strategy - - ); - - static _TAO_Policy_Strategized_Proxy_Broker * - the_TAO_Policy_Strategized_Proxy_Broker (void); - }; - - // - // End Strategized Proxy Broker Declaration - /////////////////////////////////////////////////////////////////////// - // TAO_IDL - Generated from @@ -246,10 +200,7 @@ namespace POA_CORBA static void _get_policy_type ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); // TAO_IDL - Generated from // be\be_visitor_operation/proxy_impl_xh.cpp:24 @@ -257,10 +208,7 @@ namespace POA_CORBA static void copy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); // TAO_IDL - Generated from // be\be_visitor_operation/proxy_impl_xh.cpp:24 @@ -268,10 +216,7 @@ namespace POA_CORBA static void destroy ( TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - - ); + TAO::Argument ** args); }; // diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 96e284963ef..4c33eb15523 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -5,6 +5,7 @@ #include "tao/PortableServer/Root_POA.h" #include "tao/PortableServer/Operation_Table.h" #include "tao/PortableServer/POA_Current_Impl.h" +#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h" #include "tao/Timeprobe.h" #include "tao/ORB_Core.h" @@ -328,4 +329,26 @@ TAO_ServantBase::_refcount_value (void) const return this->ref_count_.value (); } +void +TAO_ServantBase::_collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy) +{ + TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper; + collocation_upcall_wrapper.upcall ( + obj, + forward_obj, + is_forwarded, + args, + num_args, + op, + op_len, + strategy); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 5b9090eb203..f2e43803cb4 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -134,6 +134,15 @@ public: virtual CORBA::ULong _refcount_value (void) const; //@} + virtual void _collocated_dispatch (::CORBA::Object_ptr obj, + ::CORBA::Object_out forward_obj, + bool &is_forwarded, + TAO::Argument ** args, + int num_args, + const char * op, + size_t op_len, + TAO::Collocation_Strategy strategy); + protected: /// Default constructor, only derived classes can be created. diff --git a/TAO/tao/PortableServer/Servant_Upcall.cpp b/TAO/tao/PortableServer/Servant_Upcall.cpp index 5b3383148c2..e172081ef7c 100644 --- a/TAO/tao/PortableServer/Servant_Upcall.cpp +++ b/TAO/tao/PortableServer/Servant_Upcall.cpp @@ -54,7 +54,7 @@ namespace TAO { bool wait_occurred_restart_call = false; - int result = + int const result = this->prepare_for_upcall_i (key, operation, forward_to, diff --git a/TAO/tao/Remote_Object_Proxy_Broker.cpp b/TAO/tao/Remote_Object_Proxy_Broker.cpp index 8dbf58e2a23..3d5d61b6032 100644 --- a/TAO/tao/Remote_Object_Proxy_Broker.cpp +++ b/TAO/tao/Remote_Object_Proxy_Broker.cpp @@ -34,7 +34,7 @@ namespace TAO 2, "_is_a", 5, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); tao_call.invoke (0, 0); @@ -58,7 +58,7 @@ namespace TAO 1, "_non_existent", 13, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); @@ -80,7 +80,7 @@ namespace TAO 1, "_component", 10, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); @@ -118,7 +118,7 @@ namespace TAO 1, "_repository_id", 14, - 0); + TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY); _tao_call.invoke (0, 0); diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp index bcb3e3c3849..b9018137a4b 100644 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp +++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp @@ -14,7 +14,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *p, + int collocation_opportunity, Invocation_Type type, Invocation_Mode mode) : Invocation_Adapter (target->equivalent_objref (), @@ -22,7 +22,7 @@ namespace TAO arg_number, operation, op_len, - p, + collocation_opportunity, type, mode) { diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h index afac495a54f..498dd7eaae1 100644 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h +++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h @@ -51,7 +51,7 @@ namespace TAO int arg_number, const char *operation, size_t op_len, - Collocation_Proxy_Broker *cpb, + int collocation_opportunity, TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp index 01f4e0ab83f..18d9b04672e 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.cpp +++ b/TAO/tao/Valuetype/AbstractBase_T.cpp @@ -14,47 +14,23 @@ namespace TAO template<typename T> T * AbstractBase_Narrow_Utils<T>::narrow ( CORBA::AbstractBase_ptr obj, - const char *repo_id, - Proxy_Broker_Factory pbf) + const char *repo_id) { if (CORBA::is_nil (obj)) { return T::_nil (); } - if (obj->_is_a (repo_id) == false) + if (!obj->_is_a (repo_id)) { return T::_nil (); } - return - AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, repo_id, pbf); + return AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj); } template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - Proxy_Broker_Factory pbf) - { - T *proxy = 0; - - try - { - proxy = - AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, 0, pbf); - } - catch (const ::CORBA::Exception&) - { - } - - return proxy; - } - - template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - const char *, - Proxy_Broker_Factory pbf) + AbstractBase_Narrow_Utils<T>::unchecked_narrow (CORBA::AbstractBase_ptr obj) { if (CORBA::is_nil (obj)) { @@ -63,27 +39,32 @@ namespace TAO T_ptr proxy = T::_nil (); - if (obj->_is_objref ()) + try { - TAO_Stub* stub = obj->_stubobj (); - - bool const collocated = - !CORBA::is_nil (stub->servant_orb_var ().in ()) - && stub->optimize_collocation_objects () - && obj->_is_collocated () - && pbf != 0; - - ACE_NEW_THROW_EX (proxy, - T (obj->_stubobj (), - collocated, - obj->_servant ()), - CORBA::NO_MEMORY ()); + if (obj->_is_objref ()) + { + TAO_Stub* stub = obj->_stubobj (); + + bool const collocated = + !CORBA::is_nil (stub->servant_orb_var ().in ()) + && stub->optimize_collocation_objects () + && obj->_is_collocated (); + + ACE_NEW_RETURN (proxy, + T (obj->_stubobj (), + collocated, + obj->_servant ()), + T::_nil ()); + } + else + { + proxy = dynamic_cast<T *> (obj); + if (proxy) + proxy->_add_ref (); + } } - else + catch (const ::CORBA::Exception&) { - proxy = dynamic_cast<T *> (obj); - if (proxy) - proxy->_add_ref (); } return proxy; diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h index 3d088a6645b..54eb936be9f 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.h +++ b/TAO/tao/Valuetype/AbstractBase_T.h @@ -37,15 +37,9 @@ namespace TAO typedef T *T_ptr; static T_ptr narrow (CORBA::AbstractBase_ptr, - const char *repo_id, - Proxy_Broker_Factory); + const char *repo_id); - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - Proxy_Broker_Factory); - - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - const char *repo_id, - Proxy_Broker_Factory); + static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr); }; } diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 4d14a5af3a1..8e8efb4f900 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -885,6 +885,10 @@ enum TAO_Policy_Scope # define TAO_HAS_SEQUENCE_ITERATORS 0 #endif +#if !defined (TAO_DEFAULT_COLLOCATION_STRATEGY) +# define TAO_DEFAULT_COLLOCATION_STRATEGY TAO_COLLOCATION_THRU_POA +#endif + TAO_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index 3318978a531..d431edf9503 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -105,7 +105,6 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid Codeset_Manager_Factory_Base.cpp Codeset_Translator_Base.cpp Collocated_Invocation.cpp - Collocation_Proxy_Broker.cpp Collocation_Resolver.cpp Connect_Strategy.cpp Connection_Handler.cpp @@ -361,7 +360,6 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid Codeset_Manager_Factory_Base.h Codeset_Translator_Base.h Collocated_Invocation.h - Collocation_Proxy_Broker.h Collocation_Resolver.h Collocation_Strategy.h Condition.h diff --git a/TAO/tests/AMH_Oneway/server.cpp b/TAO/tests/AMH_Oneway/server.cpp index c2db9616e73..d680776d9f6 100644 --- a/TAO/tests/AMH_Oneway/server.cpp +++ b/TAO/tests/AMH_Oneway/server.cpp @@ -81,7 +81,7 @@ public: ST_AMH_Server (int *argc, ACE_TCHAR **argv); virtual ~ST_AMH_Server (); - /// ORB inititalisation stuff + /// ORB initialization stuff int start_orb_and_poa (void); /// register the servant with the poa @@ -91,7 +91,7 @@ public: virtual void run_event_loop (); /// do post-run cleanup. This is necessary here because the servant - /// supplied to regiser_servant happens to be allocated on the + /// supplied to register_servant happens to be allocated on the /// stack, and done after the instance of ST_AMH_Server is /// created. This leads to the servant being destroyed before this /// class's destructor. And alternative solution would be allocate @@ -100,7 +100,7 @@ public: virtual void cleanup (); public: - /// Accesor method (for servants) to the initialised ORB + /// Accesor method (for servants) to the initialized ORB CORBA::ORB_ptr orb () { return this->orb_.in (); } protected: diff --git a/TAO/tests/Bug_1330_Regression/Test.idl b/TAO/tests/Bug_1330_Regression/Test.idl index cf161d304ee..c4d2bf46647 100644 --- a/TAO/tests/Bug_1330_Regression/Test.idl +++ b/TAO/tests/Bug_1330_Regression/Test.idl @@ -4,5 +4,7 @@ interface Test { - void test_method(); + void test_method(); + + oneway void shutdown (); }; diff --git a/TAO/tests/Bug_1330_Regression/Test_i.cpp b/TAO/tests/Bug_1330_Regression/Test_i.cpp index ff714f3bbd6..ef2e83a8dcd 100644 --- a/TAO/tests/Bug_1330_Regression/Test_i.cpp +++ b/TAO/tests/Bug_1330_Regression/Test_i.cpp @@ -3,18 +3,22 @@ // #include "Test_i.h" -Test_i::Test_i() +Test_i::Test_i(CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) { - // Noop } Test_i::~Test_i() { - // Noop } void Test_i::test_method (void) { - // Noop +} + +void +Test_i::shutdown (void) +{ + this->orb_->shutdown (0); } diff --git a/TAO/tests/Bug_1330_Regression/Test_i.h b/TAO/tests/Bug_1330_Regression/Test_i.h index 7c5d11c210e..e1f38a78323 100644 --- a/TAO/tests/Bug_1330_Regression/Test_i.h +++ b/TAO/tests/Bug_1330_Regression/Test_i.h @@ -11,15 +11,21 @@ class Test_i: public POA_Test { public: - /// Constructor - Test_i (void); + /// Constructor + Test_i (CORBA::ORB_ptr orb); - /// Destructor - ~Test_i (void); + /// Destructor + ~Test_i (void); - /// A method - void test_method(void); + /// A method + virtual void test_method(void); + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; }; #endif /* ! BUG_1330_REGRESSION_TEST_I_H */ diff --git a/TAO/tests/Bug_1330_Regression/client.cpp b/TAO/tests/Bug_1330_Regression/client.cpp index 4a0ab7db26d..8613d306f4f 100644 --- a/TAO/tests/Bug_1330_Regression/client.cpp +++ b/TAO/tests/Bug_1330_Regression/client.cpp @@ -5,12 +5,12 @@ #include "ace/Get_Opt.h" const ACE_TCHAR *ior = ACE_TEXT("corbaloc:iiop:localhost:12345/Name\\2dwith\\2dhyphens"); -int shutdown_server = 0; +bool shutdown_server = false; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("sk:")); int c; while ((c = get_opts ()) != -1) @@ -20,7 +20,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) ior = get_opts.opt_arg (); break; case 's': - shutdown_server = 1; + shutdown_server = true; break; case '?': default: @@ -65,12 +65,16 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) server->test_method(); result =0; + if (shutdown_server) + { + server->shutdown (); + } orb->destroy (); } catch (const CORBA::Exception&) { - result =1; + result = 1; } return result; diff --git a/TAO/tests/Bug_1330_Regression/run_test.pl b/TAO/tests/Bug_1330_Regression/run_test.pl index 84dd57fcc9d..b0a809e0ccd 100755 --- a/TAO/tests/Bug_1330_Regression/run_test.pl +++ b/TAO/tests/Bug_1330_Regression/run_test.pl @@ -35,10 +35,10 @@ $SV = $server->CreateProcess ("server", "-o $server_iorfile"); $CL1 = $client->CreateProcess ("client", - "-k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); + "-ORBdebuglevel $debug_level -k \"corbaloc:iiop:$TARGETHOSTNAME:$port/Name\\2dwith\\2dhyphens\""); $CL2 = $client->CreateProcess ("client", - "-k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); + "-ORBdebuglevel $debug_level -s -k corbaloc:iiop:$TARGETHOSTNAME:$port/Name%2dwith%2dhyphens"); $server_status = $SV->Spawn (); @@ -69,7 +69,7 @@ if ($client_status != 0) { $status = 1; } -$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval()); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; diff --git a/TAO/tests/Bug_1330_Regression/server.cpp b/TAO/tests/Bug_1330_Regression/server.cpp index 1d586aa6046..e76e80c4759 100644 --- a/TAO/tests/Bug_1330_Regression/server.cpp +++ b/TAO/tests/Bug_1330_Regression/server.cpp @@ -65,10 +65,14 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (parse_args (argc, argv) != 0) return 1; - Test_i server_impl; + Test_i *server_impl = 0; + ACE_NEW_RETURN (server_impl, + Test_i (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(server_impl); PortableServer::ObjectId_var id = - root_poa->activate_object (&server_impl); + root_poa->activate_object (server_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); @@ -85,26 +89,27 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) adapter->bind("Name-with-hyphens", ior.in()); - FILE *output_file= ACE_OS::fopen (ior_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "SERVER (%P): Cannot open output file " - "for writing IOR: %C", - "server.ior"), + "for writing IOR: %s", + ior_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); ACE_DEBUG ((LM_DEBUG, - "SERVER (%P): Activated as file://%C\n", - "server.ior")); + "SERVER (%P): Activated as file://%s\n", + ior_file)); poa_manager->activate(); orb->run (); root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/Bug_2241_Regression/Client_Task.cpp b/TAO/tests/Bug_2241_Regression/Client_Task.cpp index e39e0d96191..a4fe1dbbe2c 100644 --- a/TAO/tests/Bug_2241_Regression/Client_Task.cpp +++ b/TAO/tests/Bug_2241_Regression/Client_Task.cpp @@ -18,11 +18,11 @@ Client_Task::Client_Task (const ACE_TCHAR *ior, int Client_Task::svc (void) { + CORBA::Boolean exception = false; try { CORBA::Object_var tmp = this->corb_->string_to_object (input_); - Test::Hello_var hello = Test::Hello::_narrow(tmp.in ()); @@ -33,21 +33,32 @@ Client_Task::svc (void) input_), 1); } + try + { + CORBA::String_var the_string = hello->get_string (); - CORBA::String_var the_string = - hello->get_string (); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", - the_string.in ())); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); - hello->shutdown (); + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } - + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } return 0; } diff --git a/TAO/tests/Bug_2241_Regression/Hello.cpp b/TAO/tests/Bug_2241_Regression/Hello.cpp index cabcd9145d9..fa28f2a6135 100644 --- a/TAO/tests/Bug_2241_Regression/Hello.cpp +++ b/TAO/tests/Bug_2241_Regression/Hello.cpp @@ -16,42 +16,8 @@ char * Hello::get_string (void) { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Upcall in process ..\n")); - - // Use portable thread IDs - ACE_Thread_ID self_ID; - ACE_Thread_ID this_ID; - this_ID.id(this->thr_id_); - - if (self_ID == this_ID) - { - if (this->orb_->orb_core ()->optimize_collocation_objects () && - this->orb_->orb_core ()->use_global_collocation ()) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) ERROR: A remote call has been made " - " exiting ..\n")); - ACE_OS::abort (); - } - else if (this->orb_->orb_core ()->optimize_collocation_objects () && - this->orb_->orb_core ()->use_global_collocation () == 0) - { - TAO::ORB_Table * const orb_table = - TAO::ORB_Table::instance (); - - TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); - if (tmp.get () == 0) - { - // We are running on a single ORB and this is an error. - ACE_ERROR ((LM_ERROR, - "(%P|%t) ERROR: A remote call has been made " - " with a single ORB " - " exiting ..\n")); - ACE_OS::abort (); - } - } - } + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: Unexpected Upcall in process ..\n")); return CORBA::string_dup ("Hello there!"); } diff --git a/TAO/tests/Bug_2241_Regression/README b/TAO/tests/Bug_2241_Regression/README new file mode 100644 index 00000000000..d865dd156e6 --- /dev/null +++ b/TAO/tests/Bug_2241_Regression/README @@ -0,0 +1,4 @@ +This test is build without idlflag -Gd, so Direct collocation isn't enabled. +Running this test with -ORBCollocationStrategy 'direct' should result in an Exception. + + diff --git a/TAO/tests/Bug_2241_Regression/run_test.pl b/TAO/tests/Bug_2241_Regression/run_test.pl index e9c473e8341..4cc8f95201a 100755 --- a/TAO/tests/Bug_2241_Regression/run_test.pl +++ b/TAO/tests/Bug_2241_Regression/run_test.pl @@ -18,36 +18,6 @@ $status = 0; $SV = $server->CreateProcess ("Bug_2241_Regression"); -print STDERR "======== Running in Default Mode \n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - -print STDERR "======== Running with global ORBCollocationStrategy\n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - -print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; -$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); -$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); - -if ($sv != 0) { - print STDERR "ERROR in Collocated_Test\n"; - $status = 1; -} -$server->DeleteFile($iorbase); - print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; $SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); $sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc b/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc index 960c4f67ad2..cf4dc3f81cb 100644 --- a/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc +++ b/TAO/tests/Bug_2289_Regression/Bug_2289_Regression.mpc @@ -2,7 +2,7 @@ // $Id$ project(*idl): taoidldefaults { - idlflags += -Gp -Gd -Sa -St + idlflags += -Gp -Gd IDL_Files { Test.idl } diff --git a/TAO/tests/CSD_Collocation/svc.conf.csd b/TAO/tests/CSD_Collocation/svc.conf.csd index 496c14b0103..2e5fd28b84e 100644 --- a/TAO/tests/CSD_Collocation/svc.conf.csd +++ b/TAO/tests/CSD_Collocation/svc.conf.csd @@ -8,9 +8,9 @@ static Advanced_Resource_Factory "-ORBReactorType select_st -ORBInputCDRAllocato # Make sure we use RW client handler so if something goes wrong, the program will bloc, # i.e., won't work. -static Client_Strategy_Factory "-ORBProfileLock null -ORBClientConnectionHandler RW" +static Client_Strategy_Factory "-ORBClientConnectionHandler RW" # Not absolutely necessary for this test, but we add it for fun. -static Server_Strategy_Factory "-ORBConcurrency reactive -ORBPOALock null" +static Server_Strategy_Factory "-ORBConcurrency reactive" static TAO_CSD_TP_Strategy_Factory "-CSDtp child:2:OFF" diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp new file mode 100644 index 00000000000..8887b3ce577 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.cpp @@ -0,0 +1,63 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + } + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc new file mode 100644 index 00000000000..2521cb67dda --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Best_Direct.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Enable DIRECT Collocation, disable Thru_Poa + +project(Collocated_Best_Direct): taoserver { + exename = Collocated_Best_Direct + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp new file mode 100644 index 00000000000..6494c809db8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.cpp @@ -0,0 +1,70 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl new file mode 100755 index 00000000000..39650e4147e --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_Direct/run_test.pl @@ -0,0 +1,45 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_Direct"); + +print STDERR "======== Running with ORBCollocationg = global, -ORBCollocationStrategy = direct)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +$server->DeleteFile($iorbase); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp new file mode 100644 index 00000000000..4708f2680d8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.cpp @@ -0,0 +1,62 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc new file mode 100644 index 00000000000..9604c0aff49 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Best_NoColl.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Disable Thru_Pu and don't enable Direct +project(Collocated_Best_NoColl): taoserver { + exename = Collocated_Best_NoColl + idlflags += -Sp +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp new file mode 100644 index 00000000000..cfa1a886365 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.cpp @@ -0,0 +1,76 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A remote call has been made \n")); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: An unexpected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl new file mode 100755 index 00000000000..f6009aa0dc8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_NoColl/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_NoColl"); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp new file mode 100644 index 00000000000..bfbe61b4942 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.cpp @@ -0,0 +1,63 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 1; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + } + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc new file mode 100644 index 00000000000..1d2e67eccdc --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Best_ThruP.mpc @@ -0,0 +1,7 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Poa default enabled, Direct default disabled +project(Collocated_Best_ThruP): taoserver { + exename = Collocated_Best_ThruP +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp new file mode 100644 index 00000000000..fe5d6fec8fa --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.cpp @@ -0,0 +1,68 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" +#include "./tao/Collocation_Strategy.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl new file mode 100755 index 00000000000..99836c08852 --- /dev/null +++ b/TAO/tests/Collocated_Best/Collocated_Best_ThuP/run_test.pl @@ -0,0 +1,44 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_Best_ThruP"); + +$server->DeleteFile($iorbase); +print STDERR "======== Running with ORBCollocationg = global, (default ORBCollocationStrategy = thru_poa)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy best \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy best"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_Best/README b/TAO/tests/Collocated_Best/README new file mode 100644 index 00000000000..6abd103bbe4 --- /dev/null +++ b/TAO/tests/Collocated_Best/README @@ -0,0 +1,22 @@ +// $Id$ +CollocationStrategy TAO_COLLOCATION_BEST: + +This tests performs a series of checks on CollocationStrategy 'best' (TAO_COLLOCATION_BEST) support in TAO. + +With CollocationStrategy 'best' the best possible collocation strategy is tried to perform. + If TAO_COLLOCATION_DIRECT is possible, this has to be used, else if TAO_COLLOCATION_THRU_POA + is possible this has to be used, else use remote stub. + +The test Collocated_Best_Direct uses IDLflags -Sp, to disable Thru_poa collocation + and -Gd, to enable Direct collocation. +Starting the test with -ORBCollocationStrategy 'best' , + the test should use TAO_COLLOCATION_DIRECT collocation. + +The test Collocated_Best_ThruP uses default IDLflags,so Thru_poa collocation is enabled +and Direct collocation is default not enabled. +Starting the test with -ORBCollocationStrategy 'best', the test should use +TAO_COLLOCATION_THRU_POA collocation. + +The test Collocated_Best_ThruP uses IDLflags -Sp, to disable Thru_poa collocation +and Direct collocation is default not enabled. +Starting the test with -ORBCollocationStrategy 'best', the test should use no collocation, but remote stubs.
\ No newline at end of file diff --git a/TAO/tests/Collocated_DerivedIF/Client_Task.cpp b/TAO/tests/Collocated_DerivedIF/Client_Task.cpp new file mode 100644 index 00000000000..0ea9453a73d --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Client_Task.cpp @@ -0,0 +1,69 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::HelloAgain_var hello_again = + Test::HelloAgain::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello_again.in())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::HelloAgain reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = hello_again->get_string (); + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string from hello_again returned <%C>\n", + the_string.in ())); + the_string = hello_again->get_string_again (); + + if (ACE_OS::strcmp (the_string.in (), "Bye!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string from hello_again returned <%C>\n", + the_string.in ())); + hello_again->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_DerivedIF/Client_Task.h b/TAO/tests/Collocated_DerivedIF/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc b/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc new file mode 100644 index 00000000000..7fab7ae785c --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Collocated_DerivedIF.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Pu is disabled, enable direct +project(Collocated_DIF): taoserver { + exename = Collocated_DerivedIF + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp b/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_DerivedIF/Hello.cpp b/TAO/tests/Collocated_DerivedIF/Hello.cpp new file mode 100644 index 00000000000..1db920f42f5 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Hello.cpp @@ -0,0 +1,84 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + +HelloAgain::HelloAgain (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} +char * +HelloAgain::get_string_again (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall get_string_again in process ..\n")); + + /// Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR,"(%P|%t) ERROR: A remote call has been made \n")); + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t)OK: An expected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Bye!"); +} + +char * +HelloAgain::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) HelloAgain::get_string Upcall get_string in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR,"(%P|%t) ERROR: A remote call has been made \n")); + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: An expected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} +void +HelloAgain::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} + diff --git a/TAO/tests/Collocated_DerivedIF/Hello.h b/TAO/tests/Collocated_DerivedIF/Hello.h new file mode 100644 index 00000000000..a028b36b192 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Hello.h @@ -0,0 +1,36 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + + /// Implement the Test::HelloAgain interface + class HelloAgain + : //public virtual Test::Hello, + public virtual POA_Test::HelloAgain + { + public: + /// Constructor + HelloAgain(CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string_again (void); + virtual char * get_string (void); + virtual void shutdown (void); + + + private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + ACE_thread_t thr_id_; + }; + + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_DerivedIF/README b/TAO/tests/Collocated_DerivedIF/README new file mode 100644 index 00000000000..a500775be3d --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/README @@ -0,0 +1,6 @@ +// $Id$ +CollocationStrategy direct and interface inheritance. + +The base needs to be generated also with direct collocation enabled, +otherwise no direct collocation. + diff --git a/TAO/tests/Collocated_DerivedIF/Server_Task.cpp b/TAO/tests/Collocated_DerivedIF/Server_Task.cpp new file mode 100644 index 00000000000..4d1e74d4a9a --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Server_Task.cpp @@ -0,0 +1,91 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + HelloAgain *hello_impl; + ACE_NEW_RETURN (hello_impl, + HelloAgain (this->sorb_.in (), + ACE_Thread::self ()), + 1); + PortableServer::ServantBase_var owner1_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::HelloAgain_var hello = + Test::HelloAgain::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + // ACE_OS::fprintf (output_file, "%s", ior1.in ()); + + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_DerivedIF/Server_Task.h b/TAO/tests/Collocated_DerivedIF/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_DerivedIF/Test.idl b/TAO/tests/Collocated_DerivedIF/Test.idl new file mode 100644 index 00000000000..001c6e274a2 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/Test.idl @@ -0,0 +1,23 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + oneway void shutdown (); + }; + + // A derived interface + interface HelloAgain : Hello + { + string get_string_again (); + }; +}; diff --git a/TAO/tests/Collocated_DerivedIF/run_test.pl b/TAO/tests/Collocated_DerivedIF/run_test.pl new file mode 100755 index 00000000000..5ac1c3c5df3 --- /dev/null +++ b/TAO/tests/Collocated_DerivedIF/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_DerivedIF"); + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_NoColl/Client_Task.cpp b/TAO/tests/Collocated_NoColl/Client_Task.cpp new file mode 100644 index 00000000000..4708f2680d8 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Client_Task.cpp @@ -0,0 +1,62 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var the_string = + hello->get_string (); + + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + status = 1; + } + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/Collocated_NoColl/Client_Task.h b/TAO/tests/Collocated_NoColl/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc b/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc new file mode 100644 index 00000000000..8edb4eea37c --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Collocated_NoColl.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +// Thru_Pu is default enabled +project(Collocated_NoColl): taoserver { + exename = Collocated_NoColl + +} diff --git a/TAO/tests/Collocated_NoColl/Collocated_Test.cpp b/TAO/tests/Collocated_NoColl/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_NoColl/Hello.cpp b/TAO/tests/Collocated_NoColl/Hello.cpp new file mode 100644 index 00000000000..cfa1a886365 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Hello.cpp @@ -0,0 +1,76 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A remote call has been made \n")); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + else + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: An unexpected collocated call has been made \n")); + } + } + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_NoColl/Hello.h b/TAO/tests/Collocated_NoColl/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_NoColl/Server_Task.cpp b/TAO/tests/Collocated_NoColl/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_NoColl/Server_Task.h b/TAO/tests/Collocated_NoColl/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_NoColl/Test.idl b/TAO/tests/Collocated_NoColl/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_NoColl/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_NoColl/run_test.pl b/TAO/tests/Collocated_NoColl/run_test.pl new file mode 100755 index 00000000000..0b0ac76ed01 --- /dev/null +++ b/TAO/tests/Collocated_NoColl/run_test.pl @@ -0,0 +1,33 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("Collocated_NoColl"); + +print STDERR "======== Running with -ORBCollocation no \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -ORBCollocation no"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp b/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp new file mode 100644 index 00000000000..7569e6ddb7b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Client_Task.cpp @@ -0,0 +1,65 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + CORBA::Boolean exception = false; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + try + { + CORBA::String_var the_string = + hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Client_Task.h b/TAO/tests/Collocated_ThruP_Sp/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp b/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp new file mode 100644 index 00000000000..eade083328b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Collocated_Test.cpp @@ -0,0 +1,105 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc b/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc new file mode 100644 index 00000000000..86c10ace774 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Collocated_ThruP_Sp.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Disable THRU_POA Collocation + +project(Collocated_ThruP_Sp): taoserver { + exename = Collocated_ThruP_Sp + idlflags += -Sp +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Hello.cpp b/TAO/tests/Collocated_ThruP_Sp/Hello.cpp new file mode 100644 index 00000000000..e77d95e07bc --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Hello.cpp @@ -0,0 +1,32 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_ERROR ((LM_DEBUG, + "(%P|%t) ERROR: Upcall in process ..\n")); + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Hello.h b/TAO/tests/Collocated_ThruP_Sp/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/README b/TAO/tests/Collocated_ThruP_Sp/README new file mode 100644 index 00000000000..e475dc45576 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/README @@ -0,0 +1,6 @@ +// $Id$ + +This test is build with idlflag -Sp, to disable Thru_poa collocation. +Running this test with -ORBCollocationStrategy Thru_poa should result in an Exception. + + diff --git a/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp b/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp new file mode 100644 index 00000000000..2cca42206ee --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp/Server_Task.h b/TAO/tests/Collocated_ThruP_Sp/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp/Test.idl b/TAO/tests/Collocated_ThruP_Sp/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_ThruP_Sp/run_test.pl b/TAO/tests/Collocated_ThruP_Sp/run_test.pl new file mode 100755 index 00000000000..a0812ae4f8e --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp/run_test.pl @@ -0,0 +1,60 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +$SV = $server->CreateProcess ("Collocated_ThruP_Sp"); + +print STDERR "======== Running in Default Mode \n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp new file mode 100644 index 00000000000..7569e6ddb7b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.cpp @@ -0,0 +1,65 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "TestC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + +{ +} + +int +Client_Task::svc (void) +{ + CORBA::Boolean exception = false; + try + { + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + try + { + CORBA::String_var the_string = + hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + hello->shutdown (); + } + catch (CORBA::INTERNAL) + { + exception = true; + ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n")); + corb_->destroy (); + return 0; + } + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + if (!exception) + { + ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n")); + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h new file mode 100644 index 00000000000..8f6557cdec8 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Client_Task.h @@ -0,0 +1,37 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp new file mode 100644 index 00000000000..282295ad5e3 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_Test.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +// static int named_orbs = 0; +ACE_CString server_orb; +ACE_CString client_orb; +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 'n': + // named_orbs = 1; + server_orb.set ("server_orb"); + client_orb.set ("client_orb"); + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv (), + server_orb.c_str ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv (), + client_orb.c_str ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance ()); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + if (server_orb != client_orb) + { + corb->destroy (); + } + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc new file mode 100644 index 00000000000..a5b5b6fdf8e --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Collocated_ThruP_Sp_Gd.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +// Disable THRU_POA Collocation, enable Direct Collocation + +project(Coll_ThruP_Sp-Gd): taoserver { + exename = Coll_ThruP_Sp_Gd + idlflags += -Sp -Gd +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp new file mode 100644 index 00000000000..e77d95e07bc --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.cpp @@ -0,0 +1,32 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_ERROR ((LM_DEBUG, + "(%P|%t) ERROR: Upcall in process ..\n")); + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h new file mode 100644 index 00000000000..1d5e27d075f --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Hello.h @@ -0,0 +1,34 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb, + ACE_thread_t thr_id); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + ACE_thread_t thr_id_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/README b/TAO/tests/Collocated_ThruP_Sp_Gd/README new file mode 100644 index 00000000000..c385fcfe91b --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/README @@ -0,0 +1,7 @@ +// $Id$ + +This test is build with idlflag -Sp and Gd, to disable Thru_poa collocation, +but enable direct collocation. +Running this test with -ORBCollocationStrategy Thru_poa should result in an Exception. + + diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp new file mode 100644 index 00000000000..98f37e052e3 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "TestS.h" +#include "Hello.h" + +#include "ace/Manual_Event.h" + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Hello *hello_impl; + ACE_NEW_RETURN (hello_impl, + Hello (this->sorb_.in (), + ACE_Thread::self ()), + 1); + + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = + Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = + this->sorb_->object_to_string (hello.in ()); + + // Output the IOR to the <this->output_> + FILE *output_file= ACE_OS::fopen (this->output_, + "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + this->output_), + 1); + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + // Signal the main thread before we call orb->run (); + this->me_.signal (); + + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl b/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl b/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl new file mode 100755 index 00000000000..504290188c1 --- /dev/null +++ b/TAO/tests/Collocated_ThruP_Sp_Gd/run_test.pl @@ -0,0 +1,60 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +$SV = $server->CreateProcess ("Coll_ThruP_Sp_Gd"); + +print STDERR "======== Running in Default Mode \n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + +print STDERR "======== Running with global ORBCollocationStrategy thru_poa\n"; +$SV->Arguments ("-ORBdebuglevel $debug_level -o $server_iorfile -k file://$server_iorfile -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in Collocated_Test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/Collocation_Opportunities/run_test.pl b/TAO/tests/Collocation_Opportunities/run_test.pl index 689d8586e95..91e99715397 100755 --- a/TAO/tests/Collocation_Opportunities/run_test.pl +++ b/TAO/tests/Collocation_Opportunities/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Collocation_Opportunities"); +$SV = $server->CreateProcess ("Collocation_Opportunities", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/ForwardUponObjectNotExist/client.cpp b/TAO/tests/ForwardUponObjectNotExist/client.cpp index 783d187e115..70666db32e1 100755 --- a/TAO/tests/ForwardUponObjectNotExist/client.cpp +++ b/TAO/tests/ForwardUponObjectNotExist/client.cpp @@ -178,7 +178,6 @@ Worker::run_test (void) return; } - CORBA::Boolean r = server->test_is_a ("IDL:Foo:1.0"); diff --git a/TAO/tests/ForwardUponObjectNotExist/server.cpp b/TAO/tests/ForwardUponObjectNotExist/server.cpp index eb95494366b..133182484f3 100755 --- a/TAO/tests/ForwardUponObjectNotExist/server.cpp +++ b/TAO/tests/ForwardUponObjectNotExist/server.cpp @@ -97,6 +97,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) orb->run (); ACE_DEBUG ((LM_DEBUG, "(%P|%t)server: event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/Hello/run_test.pl b/TAO/tests/Hello/run_test.pl index 719974e5c50..f45d4729c86 100755 --- a/TAO/tests/Hello/run_test.pl +++ b/TAO/tests/Hello/run_test.pl @@ -10,11 +10,14 @@ use PerlACE::TestTarget; $status = 0; $debug_level = '0'; - +$cdebug_level = '0'; foreach $i (@ARGV) { if ($i eq '-debug') { $debug_level = '10'; } + if ($i eq '-cdebug') { + $cdebug_level = '10'; + } } my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; @@ -27,7 +30,7 @@ $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); -$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$CL = $client->CreateProcess ("client", "-ORBdebuglevel $cdebug_level -k file://$client_iorfile"); $server_status = $SV->Spawn (); if ($server_status != 0) { diff --git a/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc b/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc index 92fe4fbd3bc..f04ccc6e29a 100644 --- a/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc +++ b/TAO/tests/Oneway_Buffering/Oneway_Buffering.mpc @@ -24,7 +24,6 @@ project(*Server): messaging, taoserver { project(*Client): messaging, taoclient { exename = client - requires += corba_messaging after += *idl Source_Files { diff --git a/TAO/tests/POA/Etherealization/run_test.pl b/TAO/tests/POA/Etherealization/run_test.pl index b62766a5e7e..c55d9411bd9 100755 --- a/TAO/tests/POA/Etherealization/run_test.pl +++ b/TAO/tests/POA/Etherealization/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Etherealization"); +$SV = $server->CreateProcess ("Etherealization", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl b/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl index 8da0c1f582c..edac726c827 100755 --- a/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl +++ b/TAO/tests/POA/Nested_Non_Servant_Upcalls/run_test.pl @@ -8,9 +8,17 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("Nested_Non_Servant_Upcalls"); +$SV = $server->CreateProcess ("Nested_Non_Servant_Upcalls", "-ORBdebuglevel $debug_level"); $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp new file mode 100644 index 00000000000..2bde4bbba67 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.cpp @@ -0,0 +1,87 @@ +// +// $Id$ +// + +#include "Client_Task.h" +#include "testC.h" + +Client_Task::Client_Task (const ACE_TCHAR *ior, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr, + CORBA::Boolean exception) + : ACE_Task_Base (thr_mgr) + , input_ (ior) + , corb_ (CORBA::ORB::_duplicate (corb)) + , except_ (exception) +{ +} + +int +Client_Task::svc (void) +{ + int status = 0; + try + { + // Get an object reference from the argument string. + CORBA::Object_var tmp = + this->corb_->string_to_object (input_); + + // Try to narrow the object reference to a test reference. + test_var test = test::_narrow (tmp.in ()); + if (CORBA::is_nil (test.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + input_), + 1); + } + + CORBA::String_var ior = + this->corb_->object_to_string (test.in ()); + + ACE_DEBUG ((LM_DEBUG, + "\nConnecting to: %C\n\n", + ior.in ())); + try + { + CORBA::String_var the_string = test->get_string (); + if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0) + { + ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n", + the_string.in ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - OK , correct string returned <%C>\n", + the_string.in ())); + } + test->shutdown (); + } + catch (CORBA::INTERNAL) + { + if (this->except_) + { + ACE_DEBUG ((LM_DEBUG, + "OK: Client_Task Expected exception with" + "direct collocation received\n")); + status = 0; + } + else + { + ACE_ERROR ((LM_ERROR, + "ERROR: Client_Task Unxpected exception with" + "thru_poa collocation received\n")); + status = 1; + } + } + corb_->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + status = 1; + } + + return status; + +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h new file mode 100644 index 00000000000..f1b20a22fbf --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Client_Task.h @@ -0,0 +1,39 @@ +// +// $Id$ +// + +#ifndef COLLOCATED_TEST_CLIENT_TASK_H +#define COLLOCATED_TEST_CLIENT_TASK_H +#include /**/ "ace/pre.h" +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/ORB.h" + + +/// Implement a Task to run the client as a thread +class Client_Task : public ACE_Task_Base +{ +public: + + /// Constructor + Client_Task (const ACE_TCHAR *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr, + CORBA::Boolean exception); + + /// Thread entry point + int svc (void); + +private: + const ACE_TCHAR *input_; + + CORBA::ORB_var corb_; + CORBA::Boolean except_; + +}; + +#include /**/ "ace/post.h" +#endif /* COLLOCATED_TEST_CLIENT_TASK_H */ diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp new file mode 100644 index 00000000000..53f3bf81805 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Collocated_Test.cpp @@ -0,0 +1,103 @@ +//$Id$ +#include "Server_Task.h" +#include "Client_Task.h" +#include "ace/Get_Opt.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/SString.h" +#include "ace/Manual_Event.h" + +const ACE_TCHAR *output = ACE_TEXT("test.ior"); +const ACE_TCHAR *input = ACE_TEXT("file://test.ior"); +CORBA::Boolean exception = false; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:o:td:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output = get_opts.opt_arg (); + break; + case 'k': + input = get_opts.opt_arg (); + break; + case 't': + // no exception expected + exception = false; + break; + case 'd': + // exception expected + exception = true; + break; + case '?': + default: + // This is a hack but that is okay! + return 0; + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + + if (parse_args (argc, + argv) == -1) + return -1; + + try + { + ACE_Argv_Type_Converter satc (argc, argv); + CORBA::ORB_var sorb = + CORBA::ORB_init (satc.get_argc (), + satc.get_TCHAR_argv ()); + + ACE_Manual_Event me; + Server_Task server_task (output, + sorb.in (), + me, + ACE_Thread_Manager::instance ()); + + if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating server task\n")); + } + + // Wait for the server thread to do some processing + me.wait (); + ACE_Argv_Type_Converter catc (argc, argv); + CORBA::ORB_var corb = + CORBA::ORB_init (catc.get_argc (), + catc.get_TCHAR_argv ()); + + Client_Task client_task (input, + corb.in (), + ACE_Thread_Manager::instance (), + exception); + + if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, + 1, + 1) == -1) + { + ACE_ERROR ((LM_ERROR, "Error activating client task\n")); + } + + // Wait for the client and server to finish + ACE_Thread_Manager::instance ()->wait (); + + // Now that all threads have completed we can destroy the ORB + sorb->destroy (); + } + catch (const CORBA::Exception&) + { + // Ignore exceptions.. + } + return 0; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc b/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc new file mode 100644 index 00000000000..973e9e988e1 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/On_Demand_Act_D_Coll.mpc @@ -0,0 +1,15 @@ +// -*- MPC -*- +// $Id$ + +project(On_Demand_Act_D_Coll): taoserver, portableserver { + exename = On_Demand_Act_D_Coll + idlflags += -Gd + + Source_Files { + Collocated_Test.cpp + Server_Task.cpp + Client_Task.cpp + Servant_Activator.cpp + test_i.cpp + } +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp new file mode 100644 index 00000000000..646f86ba81b --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.cpp @@ -0,0 +1,64 @@ + +//============================================================================= +/** + * @file Servant_Activator.cpp + * + * $Id$ + * + * Implementation of ServantActivator, which is used by a POA with + * a RETAIN policy. + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "Servant_Activator.h" +#include "test_i.h" +#include "ace/OS_NS_string.h" + +ServantActivator::ServantActivator (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)), + thr_id_ (thrid) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::ServantActivator\n"))); +} + +PortableServer::Servant +ServantActivator::incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::incarnate\n"))); + // Convert ObjectId to String. + CORBA::String_var s = PortableServer::ObjectId_to_string (oid); + + // If ObjectId string has a test substring, create and return a + // test_i. + + if (ACE_OS::strstr (s.in (), "test") != 0) + return new test_i (this->orb_.in (), poa, this->thr_id_); + else + { + throw CORBA::OBJECT_NOT_EXIST (); + } +} + + +void +ServantActivator::etherealize (const PortableServer::ObjectId &, + PortableServer::POA_ptr , + PortableServer::Servant servant, + CORBA::Boolean , + CORBA::Boolean remaining_activations) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ServantActivator::etherealize\n"))); + // If there are no remaining activations i.e ObjectIds associated + // with test_i delete it. + if (!remaining_activations) + delete servant; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h new file mode 100644 index 00000000000..db87624ce55 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Servant_Activator.h @@ -0,0 +1,49 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_Activator.h + * + * $Id$ + * + * Defines a ServantActivator class. + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantActivatorC.h" +#include "tao/LocalObject.h" + +#include "tao/ORB.h" + +class ServantActivator : + public virtual PortableServer::ServantActivator, + public virtual ::CORBA::LocalObject +{ +public: + ServantActivator (CORBA::ORB_ptr orb, ACE_thread_t thrid); + + /** + * This method is invoked by a POA with USE_SERVANT_MANAGER and + * RETAIN policies, whenever it receives a request for a test object + * that is not currently active. + */ + PortableServer::Servant incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa); + + /// This method is invoked whenever a test object is deactivated. + void etherealize (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr adapter, + PortableServer::Servant servant, + CORBA::Boolean cleanup_in_progress, + CORBA::Boolean remaining_activations); + +private: + /// A reference to the ORB. + CORBA::ORB_var orb_; + ACE_thread_t thr_id_; +}; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp new file mode 100644 index 00000000000..687ad1e98b6 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.cpp @@ -0,0 +1,148 @@ +// +// $Id$ +// +#include "Server_Task.h" +#include "Servant_Activator.h" +#include "ace/OS_NS_stdio.h" +#include "ace/Manual_Event.h" + +static const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); + +static int +write_iors_to_file (const char *first_ior) +{ + FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0 ) + ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IORs: %Cn", + ior_output_file), + -1); + + int result = ACE_OS::fprintf (output_file, + "%s", + first_ior); + if (result <= 0 + || static_cast<size_t> (result) != ACE_OS::strlen (first_ior)) + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_OS::fprintf failed while writing %C to %s\n", + first_ior, + ior_output_file), + -1); + + ACE_OS::fclose (output_file); + return 0; +} + +Server_Task::Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr) + : ACE_Task_Base (thr_mgr) + , output_ (output) + , me_ (me) + , sorb_ (CORBA::ORB::_duplicate (sorb)) +{ +} + +int +Server_Task::svc (void) +{ + try + { + CORBA::Object_var poa_object = + this->sorb_->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + + CORBA::PolicyList policies (4); + policies.length (4); + + // ID Assignment Policy + policies[0] = + root_poa->create_id_assignment_policy (PortableServer::USER_ID); + + // Lifespan Policy + policies[1] = + root_poa->create_lifespan_policy (PortableServer::PERSISTENT); + + // Request Processing Policy + policies[2] = + root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER); + + PortableServer::POA_var first_poa; + { + // Servant Retention Policy + policies[3] = + root_poa->create_servant_retention_policy (PortableServer::RETAIN); + + ACE_CString name = "firstPOA"; + + // Create firstPOA as the child of RootPOA with the above policies + // firstPOA will use SERVANT_ACTIVATOR because of RETAIN policy. + first_poa = root_poa->create_POA (name.c_str (), + poa_manager.in (), + policies); + + } + + // Destroy the policy objects as they have been passed to + // create_POA and no longer needed. + for (CORBA::ULong i = 0; + i < policies.length (); + ++i) + { + CORBA::Policy_ptr policy = policies[i]; + policy->destroy (); + } + // Allocate the servant activator. + ServantActivator activator (this->sorb_.in (), ACE_Thread::self ()); + // Set ServantActivator object as the servant_manager of + // firstPOA. + + first_poa->set_servant_manager (&activator); + // Create a reference with user created ID in firstPOA which uses + // the ServantActivator. + + PortableServer::ObjectId_var first_test_oid = + PortableServer::string_to_ObjectId ("first test"); + + CORBA::Object_var first_test = + first_poa->create_reference_with_id (first_test_oid.in (), "IDL:test:1.0"); + // Invoke object_to_string on the references created in firstPOA + + CORBA::String_var first_test_ior = + this->sorb_->object_to_string (first_test.in ()); + + // Print the ior's of first_test. + ACE_DEBUG((LM_DEBUG,"<%C>\n", + first_test_ior.in ())); + + int write_result = write_iors_to_file (first_test_ior.in ()); + if (write_result != 0) + return write_result; + + // Set the poa_manager state to active, ready to process requests. + poa_manager->activate (); + this->me_.signal (); + // Run the ORB. + this->sorb_->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h new file mode 100644 index 00000000000..e42043c0711 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/Server_Task.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef COLLOCATED_SERVER_TASK_H +#define COLLOCATED_SERVER_TASK_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Manual_Event; +ACE_END_VERSIONED_NAMESPACE_DECL + +/// Implement a Task to run the server in a single thread +class Server_Task : public ACE_Task_Base +{ +public: + /// Constructor + Server_Task (const ACE_TCHAR *output, + CORBA::ORB_ptr sorb, + ACE_Manual_Event &me, + ACE_Thread_Manager *thr_mgr); + + /// Thread entry point + int svc (void); + +private: + /// Output file for IOR + const ACE_TCHAR *output_; + + /// Manual event to wake up the main thread to create a client + /// thread. + ACE_Manual_Event &me_; + + CORBA::ORB_var sorb_; +}; + +#include /**/ "ace/post.h" + +#endif /* COLLOCATED_SERVER_TASK_H */ diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl b/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl new file mode 100755 index 00000000000..39409d83955 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/run_test.pl @@ -0,0 +1,44 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n"; + +$iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$status = 0; + +$SV = $server->CreateProcess ("On_Demand_Act_D_Coll"); + +print STDERR "======== Running with ORBCollocationg = global, -ORBCollocationStrategy = thru_poa)\n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -t -ORBCollocation global -ORBCollocationStrategy thru_poa"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in On_Demand_Act_D_Coll test: Servant Activator and Collocation test\n"; + $status = 1; +} +$server->DeleteFile($iorbase); + + +print STDERR "======== Running with -ORBCollocation global -ORBCollocationStrategy direct \n"; +$SV->Arguments ("-o $server_iorfile -k file://$server_iorfile -d -ORBCollocation global -ORBCollocationStrategy direct"); +$sv = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($sv != 0) { + print STDERR "ERROR in On_Demand_Act_D_Coll test: Servant Activator and Collocation test\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$server->GetStderrLog(); + +exit $status; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl new file mode 100644 index 00000000000..687502ce8f9 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test.idl @@ -0,0 +1,13 @@ +// $Id$ + +interface test +{ + /// Return a simple string + string get_string (); + + void method (); + // A twoway operation. + + void shutdown (); + // Shutdown the server. +}; diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp new file mode 100644 index 00000000000..41cd3c13348 --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.cpp @@ -0,0 +1,58 @@ +// $Id$ + +#include "test_i.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_string.h" + +// Constructor +test_i::test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + ,poa_ (PortableServer::POA::_duplicate (poa)) + ,thr_id_ (thrid) +{ +} + +void +test_i::method (void) +{ +} + +char * +test_i::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + // Use portable thread IDs + ACE_Thread_ID self_ID; + // Thread ID from Server + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + // Servant Thread ID same as Thread ID server, so a remote call, + // in case of a collocation the servant runs in calling thread (Client) + if (self_ID == this_ID) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) OK: A collocated invocation has been made.\n")); + } + return CORBA::string_dup ("Hello there!"); +} + +void +test_i::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} diff --git a/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h new file mode 100644 index 00000000000..44c4a114aea --- /dev/null +++ b/TAO/tests/POA/On_Demand_Act_Direct_Coll/test_i.h @@ -0,0 +1,44 @@ +//============================================================================= +/** + * @file test_i.h + * + * $Id$ + * + * Defines test_i class for the test interface + * + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#include "testS.h" + +class test_i : public POA_test +{ +public: + /// Constructor - takes a POA and a value parameter + test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + ACE_thread_t thr_id); + + /// A twoway operation. + void method (void); + + /// A twoway operation. + char * + get_string (void); + + /// Shutdown the ORB + void shutdown (void); + + +protected: + /// Our ORB. + CORBA::ORB_var orb_; + + /// Our POA. + PortableServer::POA_var poa_; +private: + ACE_thread_t thr_id_; +}; diff --git a/TAO/tests/Param_Test/anyop.cpp b/TAO/tests/Param_Test/anyop.cpp index 006d174f24e..c440b8198b2 100644 --- a/TAO/tests/Param_Test/anyop.cpp +++ b/TAO/tests/Param_Test/anyop.cpp @@ -87,10 +87,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:1234/Foo/Bar"); Param_Test_var param_test = - TAO::Narrow_Utils<Param_Test>::unchecked_narrow ( - obj.in (), - _TAO_Param_Test_Proxy_Broker_Factory_function_pointer - ); + TAO::Narrow_Utils<Param_Test>::unchecked_narrow (obj.in ()); TAO_Stub *stub = param_test->_stubobj (); stub->type_id = CORBA::string_dup ("IDL:Param_Test:1.0"); diff --git a/TAO/tests/Policies/Manipulation.cpp b/TAO/tests/Policies/Manipulation.cpp index 2feb981f76d..7e1169fb0f6 100644 --- a/TAO/tests/Policies/Manipulation.cpp +++ b/TAO/tests/Policies/Manipulation.cpp @@ -92,9 +92,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) orb->string_to_object ("corbaloc:iiop:localhost:12345/FakeIOR"); Test_var test = - TAO::Narrow_Utils<Test>::unchecked_narrow ( - object.in (), - _TAO_Test_Proxy_Broker_Factory_function_pointer); + TAO::Narrow_Utils<Test>::unchecked_narrow (object.in ()); if (CORBA::is_nil (test.in ())) { diff --git a/TAO/tests/Policies/Policies.mpc b/TAO/tests/Policies/Policies.mpc index 353c7a0ccec..05a385e23a3 100644 --- a/TAO/tests/Policies/Policies.mpc +++ b/TAO/tests/Policies/Policies.mpc @@ -3,5 +3,4 @@ project(Policies Manipulation): taoserver, messaging { exename = Manipulation - requires += corba_messaging } |