diff options
Diffstat (limited to 'TAO/examples/Buffered_Oneways/client.cpp')
-rw-r--r-- | TAO/examples/Buffered_Oneways/client.cpp | 86 |
1 files changed, 24 insertions, 62 deletions
diff --git a/TAO/examples/Buffered_Oneways/client.cpp b/TAO/examples/Buffered_Oneways/client.cpp index 8f1469da973..15375e78566 100644 --- a/TAO/examples/Buffered_Oneways/client.cpp +++ b/TAO/examples/Buffered_Oneways/client.cpp @@ -116,17 +116,14 @@ parse_args (int argc, char **argv) int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Initialize the ORB. CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, - 0 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + 0); // Initialize options based on command-line arguments. int parse_args_result = parse_args (argc, argv); @@ -135,25 +132,17 @@ main (int argc, char **argv) // Get an object reference from the argument string. CORBA::Object_var base = - orb->string_to_object (IOR - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->string_to_object (IOR); // Try to narrow the object reference to a <test> reference. - test_var test_object = test::_narrow (base.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + test_var test_object = test::_narrow (base.in ()); // Obtain PolicyCurrent. - base = orb->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + base = orb->resolve_initial_references ("PolicyCurrent"); // Narrow down to correct type. CORBA::PolicyCurrent_var policy_current = - CORBA::PolicyCurrent::_narrow (base.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::PolicyCurrent::_narrow (base.in ()); // Setup the none sync scope policy, i.e., the ORB will buffer // oneways. @@ -170,19 +159,14 @@ main (int argc, char **argv) // Setup the none sync scope policy. sync_none_policy_list[0] = orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE, - sync_none_any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + sync_none_any); // Setup the none sync scope. policy_current->set_policy_overrides (sync_none_policy_list, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ADD_OVERRIDE); // We are now done with this policy. - sync_none_policy_list[0]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + sync_none_policy_list[0]->destroy (); // Start off with no constraints. TAO::BufferingConstraint buffering_constraint; @@ -226,11 +210,9 @@ main (int argc, char **argv) // Setup the buffering constraint policy. buffering_constraint_policy_list[0] = orb->create_policy (TAO::BUFFERING_CONSTRAINT_POLICY_TYPE, - buffering_constraint_any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + buffering_constraint_any); - if (buffering_constraint.mode == TAO::BUFFER_FLUSH) + if (buffering_constraint.mode == TAO::BUFFER_FLUSH) { ACE_ERROR((LM_ERROR, "Error : Must specify a timeout, message" " count, or message bytes constraint.\n")); @@ -239,9 +221,7 @@ main (int argc, char **argv) // Setup the constraints. policy_current->set_policy_overrides (buffering_constraint_policy_list, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ADD_OVERRIDE); // // We use this policy again later. Therefore, we don't destroy @@ -266,9 +246,7 @@ main (int argc, char **argv) // Setup the buffering flush policy. buffering_flush_policy_list[0] = orb->create_policy (TAO::BUFFERING_CONSTRAINT_POLICY_TYPE, - buffering_flush_any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + buffering_flush_any); // // Explicit flushing policy will be used later. @@ -282,24 +260,18 @@ main (int argc, char **argv) { // Setup explicit flushing. policy_current->set_policy_overrides (buffering_flush_policy_list, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ADD_OVERRIDE); ACE_DEBUG ((LM_DEBUG, "client: Iteration %d @ %T\n", i)); // Invoke the oneway method. - test_object->method (i - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + test_object->method (i); // Reset buffering policy. policy_current->set_policy_overrides (buffering_constraint_policy_list, - CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ADD_OVERRIDE); } else { @@ -308,33 +280,27 @@ main (int argc, char **argv) i)); // Invoke the oneway method. - test_object->method (i - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + test_object->method (i); } // Interval between successive calls. ACE_Time_Value sleep_interval (0, interval * 1000); - orb->run (sleep_interval ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->run (sleep_interval); } // Shutdown server. if (shutdown_server) { - test_object->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + test_object->shutdown (); } // We are done with the policy. - buffering_constraint_policy_list[0]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + buffering_constraint_policy_list[0]->destroy (); // We are done with the policy. - buffering_flush_policy_list[0]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + buffering_flush_policy_list[0]->destroy (); // Destroy the ORB. On some platforms, e.g., Win32, the socket // library is closed at the end of main(). This means that any @@ -342,18 +308,14 @@ main (int argc, char **argv) // static destructors to flush the queues, it will be too late. // Therefore, we use explicit destruction here and flush the // queues before main() ends. - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->destroy (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); + ex._tao_print_exception ("Exception caught:"); return -1; } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); return 0; } |