summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_1482_Regression
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
commit6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch)
treeda50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tests/Bug_1482_Regression
parent0e555b9150d38e3b3473ba325b56db2642e6352b (diff)
downloadATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/tests/Bug_1482_Regression')
-rw-r--r--TAO/tests/Bug_1482_Regression/.cvsignore2
-rw-r--r--TAO/tests/Bug_1482_Regression/Bug_1482_Regression.mpc20
-rw-r--r--TAO/tests/Bug_1482_Regression/Client_Task.cpp73
-rw-r--r--TAO/tests/Bug_1482_Regression/Client_Task.h43
-rw-r--r--TAO/tests/Bug_1482_Regression/Hello.cpp48
-rw-r--r--TAO/tests/Bug_1482_Regression/Hello.h36
-rw-r--r--TAO/tests/Bug_1482_Regression/Reply_Handler.cpp49
-rw-r--r--TAO/tests/Bug_1482_Regression/Reply_Handler.h32
-rw-r--r--TAO/tests/Bug_1482_Regression/Server_Task.cpp32
-rw-r--r--TAO/tests/Bug_1482_Regression/Server_Task.h34
-rw-r--r--TAO/tests/Bug_1482_Regression/Test.idl14
-rw-r--r--TAO/tests/Bug_1482_Regression/client.cpp140
-rwxr-xr-xTAO/tests/Bug_1482_Regression/run_test.pl71
-rw-r--r--TAO/tests/Bug_1482_Regression/server.cpp125
14 files changed, 0 insertions, 719 deletions
diff --git a/TAO/tests/Bug_1482_Regression/.cvsignore b/TAO/tests/Bug_1482_Regression/.cvsignore
deleted file mode 100644
index f2ad85300eb..00000000000
--- a/TAO/tests/Bug_1482_Regression/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-client
-server
diff --git a/TAO/tests/Bug_1482_Regression/Bug_1482_Regression.mpc b/TAO/tests/Bug_1482_Regression/Bug_1482_Regression.mpc
deleted file mode 100644
index 26363b5c9bc..00000000000
--- a/TAO/tests/Bug_1482_Regression/Bug_1482_Regression.mpc
+++ /dev/null
@@ -1,20 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(*Server): taoserver, amh, ami, iortable, portableserver {
- Source_Files {
- Hello.cpp
- Server_Task.cpp
- server.cpp
- }
-}
-
-project(*Client): taoserver, amh, ami {
- exename = client
- after += *Server
- Source_Files {
- Client_Task.cpp
- Reply_Handler.cpp
- client.cpp
- }
-}
diff --git a/TAO/tests/Bug_1482_Regression/Client_Task.cpp b/TAO/tests/Bug_1482_Regression/Client_Task.cpp
deleted file mode 100644
index 9710790c0af..00000000000
--- a/TAO/tests/Bug_1482_Regression/Client_Task.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// $Id$
-//
-
-#include "Client_Task.h"
-#include "tao/Stub.h"
-
-ACE_RCSID(Muxing, Client_Task, "$Id$")
-
-Client_Task::Client_Task (Test::Hello_ptr receiver,
- CORBA::ORB_ptr o,
- ACE_Thread_Manager *thr_mgr)
- : ACE_Task_Base (thr_mgr)
- , receiver_ (Test::Hello::_duplicate (receiver))
- , handler_ (o)
- , handler_var_ ()
- , orb_ (CORBA::ORB::_duplicate (o))
-{
- this->handler_var_ = this->handler_._this ();
- this->handler_var_->_stubobj ()->_incr_refcnt ();
- this->handler_var_->_add_ref ();
-}
-
-Client_Task::~Client_Task (void)
-{
- (void) this->handler_var_._retn ();
-}
-
-int
-Client_Task::svc (void)
-{
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting client task\n"));
-
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- for (CORBA::Long j = 0;
- j != 1000;
- ++j)
- {
- // Send 25 messages in every loop..
- for (CORBA::Short i = 0; i != 25; ++i)
- {
- this->receiver_->sendc_next_prime (this->handler_var_.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
-
- CORBA::Short repl = 0;
- while (repl != 25)
- {
- CORBA::Boolean pending =
- this->orb_->work_pending (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (pending)
- {
- this->orb_->perform_work (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- ++repl;
- }
- }
- }
- }
- ACE_CATCHANY
- {
- return -1;
- }
- ACE_ENDTRY;
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client task finished\n"));
- return 0;
-}
diff --git a/TAO/tests/Bug_1482_Regression/Client_Task.h b/TAO/tests/Bug_1482_Regression/Client_Task.h
deleted file mode 100644
index 07e59e3c5c2..00000000000
--- a/TAO/tests/Bug_1482_Regression/Client_Task.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// $Id$
-//
-
-#ifndef LONGUPCALLS_CLIENT_TASK_H
-#define LONGUPCALLS_CLIENT_TASK_H
-#include /**/ "ace/pre.h"
-
-#include "TestC.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "Reply_Handler.h"
-#include "ace/Task.h"
-
-/// Implement a Task to run the experiments using multiple threads.
-class Client_Task : public ACE_Task_Base
-{
-public:
- /// Constructor
- Client_Task (Test::Hello_ptr receiver,
- CORBA::ORB_ptr o,
- ACE_Thread_Manager *thr_mgr);
-
- ~Client_Task (void);
-
- /// Thread entry point
- int svc (void);
-
-private:
- /// Reference to the test interface
- Test::Hello_var receiver_;
-
- Reply_Handler handler_;
-
- Test::AMI_HelloHandler_var handler_var_;
-
- CORBA::ORB_var orb_;
-};
-#include /**/ "ace/post.h"
-#endif /* LONGUPCALLS_CLIENT_TASK_H */
diff --git a/TAO/tests/Bug_1482_Regression/Hello.cpp b/TAO/tests/Bug_1482_Regression/Hello.cpp
deleted file mode 100644
index 40d7a6c63e7..00000000000
--- a/TAO/tests/Bug_1482_Regression/Hello.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// $Id$
-//
-#include "Hello.h"
-#include "ace/ACE.h"
-
-
-ACE_RCSID (Bug_1482_Regression,
- Hello,
- "$Id$")
-
-
-Hello::Hello (CORBA::ORB_ptr orb)
- : orb_ (CORBA::ORB::_duplicate (orb))
- , mutex_ ()
- , latest_prime_ (0)
-{
-}
-
-CORBA::ULong
-Hello::next_prime (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- ace_mon,
- this->mutex_,
- this->latest_prime_);
-
- if (this->latest_prime_ > 10000)
- ACE_OS::abort ();
-
- for (CORBA::Long ind = 0;
- ind != 400;
- ++ind)
- {
- CORBA::Short bc = 0;
-
- while (bc == 0)
- {
- if (ACE::is_prime (++this->latest_prime_,
- 2,
- this->latest_prime_/2) == 0)
- bc = 1;
- }
- }
-
- return this->latest_prime_;
-}
diff --git a/TAO/tests/Bug_1482_Regression/Hello.h b/TAO/tests/Bug_1482_Regression/Hello.h
deleted file mode 100644
index 58a5fd909b3..00000000000
--- a/TAO/tests/Bug_1482_Regression/Hello.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// $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);
-
- // = The skeleton methods
- virtual CORBA::ULong next_prime (ACE_ENV_SINGLE_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException));
-
-private:
- /// Use an ORB reference to conver strings to objects and shutdown
- /// the application.
- CORBA::ORB_var orb_;
-
- /// Mutex
- TAO_SYNCH_MUTEX mutex_;
-
- /// Latest prime
- CORBA::ULong latest_prime_;
-};
-
-#include /**/ "ace/post.h"
-#endif /* HELLO_H */
diff --git a/TAO/tests/Bug_1482_Regression/Reply_Handler.cpp b/TAO/tests/Bug_1482_Regression/Reply_Handler.cpp
deleted file mode 100644
index 93189526614..00000000000
--- a/TAO/tests/Bug_1482_Regression/Reply_Handler.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id$
-#include "Reply_Handler.h"
-
-Reply_Handler::Reply_Handler (CORBA::ORB_ptr o)
- : orb_ (CORBA::ORB::_duplicate (o))
-{
-}
-
-void
-Reply_Handler::next_prime (CORBA::ULong
- ACE_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- return;
-}
-
-void
-Reply_Handler::next_prime_excep (
- ::Messaging::ExceptionHolder *ex
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
-
- ACE_TRY
- {
- ex->raise_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCH (CORBA::COMM_FAILURE, t)
- {
- /*ACE_DEBUG ((LM_DEBUG,
- "Callback method <next_prime_excep> called: \n"));
- */
-
- ACE_Time_Value tv (10, 0);
- this->orb_->run (tv ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception:");
- }
- ACE_ENDTRY;
- ACE_CHECK;
-}
diff --git a/TAO/tests/Bug_1482_Regression/Reply_Handler.h b/TAO/tests/Bug_1482_Regression/Reply_Handler.h
deleted file mode 100644
index 03700034b3e..00000000000
--- a/TAO/tests/Bug_1482_Regression/Reply_Handler.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// $Id$
-#ifndef REPLY_HANDLER_H
-#define REPLY_HANDLER_H
-#include /**/ "ace/pre.h"
-#include "TestS.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-class Reply_Handler : public POA_Test::AMI_HelloHandler
-{
-public:
- Reply_Handler (CORBA::ORB_ptr o);
-
-
- void next_prime (CORBA::ULong ami_return_val
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException));
-
- void next_prime_excep (::Messaging::ExceptionHolder * excep_holder
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException));
-
-private:
-
- CORBA::ORB_var orb_;
-};
-
-
-#include /**/ "ace/post.h"
-#endif /*REPLY_HANDLER_H*/
diff --git a/TAO/tests/Bug_1482_Regression/Server_Task.cpp b/TAO/tests/Bug_1482_Regression/Server_Task.cpp
deleted file mode 100644
index 8c0dc31bdd1..00000000000
--- a/TAO/tests/Bug_1482_Regression/Server_Task.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// $Id$
-//
-#include "Server_Task.h"
-
-ACE_RCSID(Muxing, Server_Task, "$Id$")
-
-Server_Task::Server_Task (CORBA::ORB_ptr orb,
- ACE_Thread_Manager *thr_mgr)
- : ACE_Task_Base (thr_mgr)
- , orb_ (CORBA::ORB::_duplicate (orb))
-{
-}
-
-int
-Server_Task::svc (void)
-{
-// ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting server task\n"));
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- return -1;
- }
- ACE_ENDTRY;
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Server task finished\n"));
- return 0;
-}
diff --git a/TAO/tests/Bug_1482_Regression/Server_Task.h b/TAO/tests/Bug_1482_Regression/Server_Task.h
deleted file mode 100644
index 3df83651af5..00000000000
--- a/TAO/tests/Bug_1482_Regression/Server_Task.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// $Id$
-//
-
-#ifndef LONGUPCALLS_SERVER_TASK_H
-#define LONGUPCALLS_SERVER_TASK_H
-#include /**/ "ace/pre.h"
-
-#include "ace/Task.h"
-
-#include "tao/ORB.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-/// Implement a Task to run the experiments using multiple threads.
-class Server_Task : public ACE_Task_Base
-{
-public:
- /// Constructor
- Server_Task (CORBA::ORB_ptr orb,
- ACE_Thread_Manager *thr_mgr);
-
- /// Thread entry point
- int svc (void);
-
-private:
- /// Reference to the ORB
- CORBA::ORB_var orb_;
-};
-
-#include /**/ "ace/post.h"
-#endif /* LONGUPCALLS_SERVER_TASK_H */
diff --git a/TAO/tests/Bug_1482_Regression/Test.idl b/TAO/tests/Bug_1482_Regression/Test.idl
deleted file mode 100644
index 22d8aee58d9..00000000000
--- a/TAO/tests/Bug_1482_Regression/Test.idl
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// $Id$
-//
-
-/// Put the interfaces in a module, to avoid global namespace pollution
-module Test
-{
- /// A very simple interface
- interface Hello
- {
- /// Return a simple string
- unsigned long next_prime ();
- };
-};
diff --git a/TAO/tests/Bug_1482_Regression/client.cpp b/TAO/tests/Bug_1482_Regression/client.cpp
deleted file mode 100644
index 78a8635a4e5..00000000000
--- a/TAO/tests/Bug_1482_Regression/client.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// $Id$
-
-#include "TestS.h"
-#include "Client_Task.h"
-#include "ace/Get_Opt.h"
-#include "tao/AnyTypeCode/Any.h"
-
-ACE_RCSID(Hello, client, "$Id$")
-
-const char *ior = "file://test.ior";
-
-int
-parse_args (int argc, char *argv[])
-{
- ACE_Get_Opt get_opts (argc, argv, "k:");
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'k':
- ior = get_opts.opt_arg ();
- break;
-
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "-k <ior> "
- "\n",
- argv [0]),
- -1);
- }
- // Indicates sucessful parsing of the command line
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- ACE_TRY_NEW_ENV
- {
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (parse_args (argc, argv) != 0)
- return 1;
-
- CORBA::Object_var tmp =
- orb->string_to_object(ior ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- Test::Hello_var hello =
- Test::Hello::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (CORBA::is_nil (hello.in ()))
- {
- ACE_ERROR_RETURN ((LM_DEBUG,
- "Nil Test::Hello reference <%s>\n",
- ior),
- 1);
- }
-
- CORBA::Object_var poa_object =
- orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (poa_object.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
-
- CORBA::Object_var object =
- orb->resolve_initial_references ("PolicyCurrent"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- CORBA::PolicyCurrent_var policy_current =
- CORBA::PolicyCurrent::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- TimeBase::TimeT timeout_period = 10 * 1000;
-
- CORBA::Any timeout_as_any;
- timeout_as_any <<= timeout_period;
-
- CORBA::PolicyList policy_list (1);
- policy_list.length (1);
- policy_list[0] =
- orb->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
- timeout_as_any
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- policy_current->set_policy_overrides (policy_list,
- CORBA::ADD_OVERRIDE
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
-
- // Let the client perform the test in a separate thread
- Client_Task client (hello.in (),
- orb.in (),
- ACE_Thread_Manager::instance ());
-
- if (client.activate (THR_NEW_LWP | THR_JOINABLE,
- 8) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Cannot activate client threads\n"),
- 1);
-
- client.thr_mgr ()->wait ();
-
- root_poa->destroy (1, // ethernalize objects
- 0 // wait for completion
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Exception caught:");
- return 1;
- }
- ACE_ENDTRY;
-
- return 0;
-}
diff --git a/TAO/tests/Bug_1482_Regression/run_test.pl b/TAO/tests/Bug_1482_Regression/run_test.pl
deleted file mode 100755
index a62e792625a..00000000000
--- a/TAO/tests/Bug_1482_Regression/run_test.pl
+++ /dev/null
@@ -1,71 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# $Id$
-# -*- perl -*-
-
-use lib '../../../bin';
-use PerlACE::Run_Test;
-
-$iorfile = PerlACE::LocalFile ("server.ior");
-unlink $iorfile;
-
-if (PerlACE::is_vxworks_test()) {
- $SV = new PerlACE::ProcessVX ("server", "-o server.ior -ORBdotteddecimaladdresses 1");
-}
-else {
- $SV = new PerlACE::Process ("server", "-o $iorfile -ORBdotteddecimaladdresses 1");
-}
-$CL1 = new PerlACE::Process ("client", "-k file://$iorfile");
-$CL2 = new PerlACE::Process ("client", "-k file://$iorfile");
-$CL3 = new PerlACE::Process ("client", "-k file://$iorfile");
-
-local $start_time = time();
-local $max_running_time = 600; # 5 minutes
-local $elapsed = time() - $start_time;
-
-while($elapsed < $max_running_time) {
-
-print STDERR " Going .. \n";
-$sv1 = $SV->Spawn ();
-
-if (PerlACE::waitforfile_timed ($iorfile,
- $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
-}
-# Start all clients in parallel
-$client1 = $CL1->Spawn ();
-$client2 = $CL2->Spawn ();
-$client3 = $CL3->Spawn ();
-
-
-sleep (60);
-$SV->WaitKill (3) unless $sv1 < 0;
-$CL1->WaitKill (3);
-$CL2->WaitKill (3);
-$CL3->WaitKill (3);
-
-if ($client3 != 0){
- $status = -1;
- exit $status;
-}
-
-if ($client2 != 0) {
- $status = -1;
- exit $status;
-}
-
-if ($client1 != 0){
- $status = -1;
- exit $status;
-}
- $elapsed = time() - $start_time;
-unlink $iorfile;
-}
-
-
-
-exit $status;
diff --git a/TAO/tests/Bug_1482_Regression/server.cpp b/TAO/tests/Bug_1482_Regression/server.cpp
deleted file mode 100644
index 2204fc213da..00000000000
--- a/TAO/tests/Bug_1482_Regression/server.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// $Id$
-
-#include "Hello.h"
-#include "ace/Get_Opt.h"
-#include "Server_Task.h"
-
-ACE_RCSID (LongUpcall_Crash_Test,
- server,
- "$Id$")
-
-const char *ior_output_file = "test.ior";
-
-int
-parse_args (int argc, char *argv[])
-{
- ACE_Get_Opt get_opts (argc, argv, "o:");
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'o':
- ior_output_file = get_opts.opt_arg ();
- break;
-
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "-o <iorfile>"
- "\n",
- argv [0]),
- -1);
- }
- // Indicates sucessful parsing of the command line
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- ACE_TRY_NEW_ENV
- {
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CORBA::Object_var poa_object =
- orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- 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 (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (parse_args (argc, argv) != 0)
- return 1;
-
- Hello *hello_impl;
- ACE_NEW_RETURN (hello_impl,
- Hello (orb.in ()),
- 1);
- PortableServer::ServantBase_var owner_transfer(hello_impl);
-
- Test::Hello_var hello =
- hello_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CORBA::String_var ior =
- orb->object_to_string (hello.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- // Output the IOR to the <ior_output_file>
- FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
- if (output_file == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Cannot open output file for writing IOR: %s",
- ior_output_file),
- 1);
- ACE_OS::fprintf (output_file, "%s", ior.in ());
- ACE_OS::fclose (output_file);
-
- poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- Server_Task st (orb.in (),
- ACE_Thread_Manager::instance ());
-
- if (st.activate (THR_NEW_LWP | THR_JOINABLE, 4, 1) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "Error activating server task\n"));
-
- return -1;
- }
- orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
-
- root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Exception caught:");
- return 1;
- }
- ACE_ENDTRY;
-
- return 0;
-}