diff options
author | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-05 13:59:41 +0000 |
---|---|---|
committer | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-05 13:59:41 +0000 |
commit | a0c99cc268f1df43e810fc9ea2dc541eea7744e8 (patch) | |
tree | 85f3a7fcabcb7eecd034f788c2e0098095270359 | |
parent | 45bbd78a9a229f06233ff16ff1e1f8d9b2783931 (diff) | |
download | ATCD-a0c99cc268f1df43e810fc9ea2dc541eea7744e8.tar.gz |
ChangeLogTag: Mon Mar 5 07:59:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 18 | ||||
-rw-r--r-- | TAO/examples/PluggableUDP/DIOP/README | 40 | ||||
-rw-r--r-- | TAO/examples/mfc/client.cpp | 70 | ||||
-rw-r--r-- | TAO/examples/mfc/server.cpp | 133 | ||||
-rw-r--r-- | TAO/tests/AMI/client.cpp | 14 | ||||
-rw-r--r-- | TAO/tests/AMI/server.cpp | 5 | ||||
-rw-r--r-- | TAO/tests/AMI/simple_client.cpp | 8 |
7 files changed, 209 insertions, 79 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 79d3dd37130..53254b238ec 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,21 @@ +Mon Mar 5 07:59:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> + + * tests/AMI/client.cpp: + * tests/AMI/simple_client.cpp: + * tests/AMI/server.cpp: + * examples/mfc/client.cpp: + * examples/mfc/server.cpp: + + Fixed exception handling, especially missing ACE_TRY_ENVs for + CORBA::ORB::resolve_initial_references (). Thanks to Ossama for + pointing this out. + + * examples/PluggableUDP/Diop/README: + + Added a small paragraph about the limitations of the current + DIOP implemenation. + Also, added a disclaimer. + Mon Mar 5 04:42:52 2001 Yamuna Krishnamurthy <yamuna@cs.wustl.edu> * orbsvcs/tests/AVStreams/Comp_Test/ftp.h: diff --git a/TAO/examples/PluggableUDP/DIOP/README b/TAO/examples/PluggableUDP/DIOP/README index a009ee80cc0..3f00555185c 100644 --- a/TAO/examples/PluggableUDP/DIOP/README +++ b/TAO/examples/PluggableUDP/DIOP/README @@ -54,6 +54,46 @@ Issues: - Remove commented out code from DIOP_* files. +Limitations: + +- No preconnections are supported. + +- Only single threaded servers are supported as we cache parts of a UDP + packet. If we would allow multiple threads this buffer could be corrupted. + +- No thread-per connection is supported. + +- Requests from multiple clients are received on the same socket. + + +Disclaimer: + + This UDP Pluggable Protocol has been developed for Siemens base station + software. We assumed certain requriements, which do not fit everybody, so + be careful applying this pluggable protocol to your application. + + The assumptions we had: + + - Almost 100% reliable UDP communication as we use IP over ATM + + (Even if it would be less reliable you can manage it by using one-way + request operations and one-way response operations in combination with + application level timeouts.) + + - TCP got ruled out as it behaves to sluggish on sudden disconnections, we + needed to be able to plug & play CPU cards without impacting any ORB + communicating to that CPU. + + (This is the main reason why we do not keep any state in the client side + of the Pluggable Protocol) + + - As we use a special hardware configuration we defined that every GIOP message + (and therefore every IDL signature) message is shorter than 4kB, which is the + maximum length of a UDP packet anyway. + + (Support for fragmentation, as GIOP 1.2 supports it might help, this is + a future option) + Appendix: diff --git a/TAO/examples/mfc/client.cpp b/TAO/examples/mfc/client.cpp index 8c7ad923928..a0bb4dd105f 100644 --- a/TAO/examples/mfc/client.cpp +++ b/TAO/examples/mfc/client.cpp @@ -7,40 +7,60 @@ int main (int argc, char *argv[]) { - const char *orb_name = ""; + ACE_TRY_NEW_ENV + { + const char *orb_name = ""; - cout << "Initializing the ORB!" << endl; - CORBA::ORB_var the_orb = CORBA::ORB_init (argc, - argv, - orb_name); - CORBA::Object_var orb_obj = - the_orb->resolve_initial_references ("RootPOA"); + cout << "Initializing the ORB!" << endl; + CORBA::ORB_var the_orb = CORBA::ORB_init (argc, + argv, + orb_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; - PortableServer::POA_var the_root_poa = - PortableServer::POA::_narrow (orb_obj.in ()); - PortableServer::POAManager_var the_poa_manager = - the_root_poa->the_POAManager (); + CORBA::Object_var orb_obj = + the_orb->resolve_initial_references ("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; - // Retrieving the servants IOR from a file - cout << "Reading the IOR!" << endl; + PortableServer::POA_var the_root_poa = + PortableServer::POA::_narrow (orb_obj.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; - const char *filename = - "file://ior.txt"; + PortableServer::POAManager_var the_poa_manager = + the_root_poa->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; - orb_obj = - the_orb->string_to_object (filename); + // Retrieving the servants IOR from a file + cout << "Reading the IOR!" << endl; - cout << "Narrowing the IOR!" << endl; + const char *filename = + "file://ior.txt"; - W32_Test_Interface_var mycall = - W32_Test_Interface::_narrow (orb_obj.in ()); + orb_obj = + the_orb->string_to_object (filename, ACE_TRY_ENV); + ACE_TRY_CHECK; - cout << "Sending the Request!" << endl; - char *response = mycall->getresponse (1); - cout << "The answer ..." << response << endl; + cout << "Narrowing the IOR!" << endl; - // Free up the string. - CORBA::string_free (response); + W32_Test_Interface_var mycall = + W32_Test_Interface::_narrow (orb_obj.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + + cout << "Sending the Request!" << endl; + char *response = mycall->getresponse (1); + cout << "The answer ..." << response << endl; + + // Free up the string. + CORBA::string_free (response); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Catched exception:"); + return 1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); return 0; } diff --git a/TAO/examples/mfc/server.cpp b/TAO/examples/mfc/server.cpp index 84e257e8d0d..0b5e4803b11 100644 --- a/TAO/examples/mfc/server.cpp +++ b/TAO/examples/mfc/server.cpp @@ -41,41 +41,61 @@ END_MESSAGE_MAP() static void * spawn_my_orb_thread (void *) { - // Initialization arguments for the ORB - const char *orb_name = ""; - - CORBA::ORB_var the_orb = - CORBA::ORB_init (__argc, - __argv, - orb_name); - - CORBA::Object_var orb_obj = - the_orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var the_root_poa = - PortableServer::POA::_narrow (orb_obj.in ()); - - PortableServer::POAManager_var the_poa_manager = - the_root_poa->the_POAManager (); - - the_poa_manager->activate (); - - // Initializing the NamingService - W32_Test_Impl myservant; - W32_Test_Interface_var orb_servant = - myservant._this(); - - CORBA::String_var ior = - the_orb->object_to_string (orb_servant.in ()); - - FILE *output_file = ACE_OS::fopen ("ior.txt", - "w"); - ACE_OS::fprintf (output_file, - "%s", - ior.in ()); - ACE_OS::fclose (output_file); - - the_orb->run (); + ACE_TRY_NEW_ENV + { + // Initialization arguments for the ORB + const char *orb_name = ""; + + CORBA::ORB_var the_orb = + CORBA::ORB_init (__argc, + __argv, + orb_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Object_var orb_obj = + the_orb->resolve_initial_references ("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POA_var the_root_poa = + PortableServer::POA::_narrow (orb_obj.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POAManager_var the_poa_manager = + the_root_poa->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; + + the_poa_manager->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Initializing the NamingService + W32_Test_Impl myservant; + W32_Test_Interface_var orb_servant = + myservant._this (ACE_TRY_CHECK); + ACE_TRY_CHECK; + + CORBA::String_var ior = + the_orb->object_to_string (orb_servant.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + + FILE *output_file = ACE_OS::fopen ("ior.txt", + "w"); + ACE_OS::fprintf (output_file, + "%s", + ior.in ()); + ACE_OS::fclose (output_file); + + the_orb->run (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Catched exception:"); + return 0; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (0); return 0; } @@ -92,21 +112,36 @@ CServerApp::CServerApp() CServerApp::~CServerApp() { - CORBA::ORB_var the_shutdown_orb; + ACE_TRY_NEW_ENV + { + CORBA::ORB_var the_shutdown_orb; + + int argc = 0; + char **argv = 0; + const char *orb_name = ""; + + // Retrieving a reference to the ORB used inside the thread + the_shutdown_orb = + CORBA::ORB_init (argc, + argv, + orb_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + the_shutdown_orb->shutdown (0, // wait_for_completion + ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_Thread_Manager::instance ()->wait (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Catched exception:"); + } + ACE_ENDTRY; + ACE_CHECK; - int argc = 0; - char **argv = 0; - const char *orb_name = ""; - - // Retrieving a reference to the ORB used inside the thread - the_shutdown_orb = - CORBA::ORB_init (argc, - argv, - orb_name); - - the_shutdown_orb->shutdown (); - - ACE_Thread_Manager::instance ()->wait (); ACE::fini (); } diff --git a/TAO/tests/AMI/client.cpp b/TAO/tests/AMI/client.cpp index dce4ec273af..68d94269454 100644 --- a/TAO/tests/AMI/client.cpp +++ b/TAO/tests/AMI/client.cpp @@ -132,6 +132,7 @@ public: "Catched exception:"); } ACE_ENDTRY; + ACE_CHECK; }; void get_yadda (CORBA::Long result, @@ -209,7 +210,9 @@ main (int argc, char *argv[]) // Activate POA to handle the call back. CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); + orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; + if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), @@ -245,10 +248,14 @@ main (int argc, char *argv[]) } // ORB loop. - while (orb->work_pending () && number_of_replies > 0) + while (orb->work_pending (ACE_TRY_ENV) && number_of_replies > 0) { - orb->perform_work (); + ACE_TRY_CHECK; + + orb->perform_work (ACE_TRY_ENV); + ACE_TRY_CHECK; } + ACE_TRY_CHECK; if (debug) { @@ -271,6 +278,7 @@ main (int argc, char *argv[]) return 1; } ACE_ENDTRY; + ACE_CHECK_RETURN (-1); return 0; } diff --git a/TAO/tests/AMI/server.cpp b/TAO/tests/AMI/server.cpp index e52ef915ec6..01d3adf7961 100644 --- a/TAO/tests/AMI/server.cpp +++ b/TAO/tests/AMI/server.cpp @@ -62,7 +62,9 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); + orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; + if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), @@ -119,6 +121,7 @@ main (int argc, char *argv[]) return 1; } ACE_ENDTRY; + ACE_CHECK_RETURN (-1); return 0; } diff --git a/TAO/tests/AMI/simple_client.cpp b/TAO/tests/AMI/simple_client.cpp index c372e0b2c00..cbb36087457 100644 --- a/TAO/tests/AMI/simple_client.cpp +++ b/TAO/tests/AMI/simple_client.cpp @@ -122,6 +122,7 @@ public: "... caught the wrong exception -> ERROR\n")); } ACE_ENDTRY; + ACE_CHECK; }; @@ -293,7 +294,11 @@ main (int argc, char *argv[]) } if (shutdown_flag) - ami_test_var->shutdown (); + { + ami_test_var->shutdown (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + } ACE_CATCHANY { @@ -302,6 +307,7 @@ main (int argc, char *argv[]) return 1; } ACE_ENDTRY; + ACE_CHECK_RETURN (-1); return 0; } |