summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-13 15:55:49 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-13 15:55:49 +0000
commit2baebabeccbaccc4b98fccdf8cb9fb35e36b2dcc (patch)
tree0327dd1cc1aba4255073e23e54d1af197d0591bb
parentbbf97afcb91f0cfadd30a49758bbf15df5e54f23 (diff)
downloadATCD-2baebabeccbaccc4b98fccdf8cb9fb35e36b2dcc.tar.gz
Tue Oct 13 15:54:44 UTC 2009 Vladimir Zykov <vz@prismtech.com>
* tests/Bug_3748_Regression/client.cpp: * tests/Bug_3748_Regression/Bug_3748_Regression.mpc: * tests/Bug_3748_Regression/Hello.cpp: * tests/Bug_3748_Regression/Test.idl: * tests/Bug_3748_Regression/server.cpp: * tests/Bug_3748_Regression/Makefile.am: * tests/Bug_3748_Regression/Hello.h: * tests/Bug_3748_Regression/README: * tests/Bug_3748_Regression/run_test.pl: * bin/tao_orb_tests.lst: Added a test for bug#3748.
-rw-r--r--TAO/ChangeLog30
-rw-r--r--TAO/bin/tao_orb_tests.lst1
-rw-r--r--TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc37
-rw-r--r--TAO/tests/Bug_3748_Regression/Hello.cpp25
-rw-r--r--TAO/tests/Bug_3748_Regression/Hello.h32
-rw-r--r--TAO/tests/Bug_3748_Regression/Makefile.am105
-rw-r--r--TAO/tests/Bug_3748_Regression/README5
-rw-r--r--TAO/tests/Bug_3748_Regression/Test.idl20
-rw-r--r--TAO/tests/Bug_3748_Regression/client.cpp110
-rwxr-xr-xTAO/tests/Bug_3748_Regression/run_test.pl90
-rw-r--r--TAO/tests/Bug_3748_Regression/server.cpp203
11 files changed, 650 insertions, 8 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index f6d1cdb663c..7472d82afb2 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,23 +1,37 @@
+Tue Oct 13 15:54:44 UTC 2009 Vladimir Zykov <vz@prismtech.com>
+
+ * tests/Bug_3748_Regression/client.cpp:
+ * tests/Bug_3748_Regression/Bug_3748_Regression.mpc:
+ * tests/Bug_3748_Regression/Hello.cpp:
+ * tests/Bug_3748_Regression/Test.idl:
+ * tests/Bug_3748_Regression/server.cpp:
+ * tests/Bug_3748_Regression/Makefile.am:
+ * tests/Bug_3748_Regression/Hello.h:
+ * tests/Bug_3748_Regression/README:
+ * tests/Bug_3748_Regression/run_test.pl:
+ * bin/tao_orb_tests.lst:
+ Added a test for bug#3748.
+
Tue Oct 13 15:36:48 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp:
* TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h:
-
+
New files, containing new visitor that generates the implementation
of the facet servant class.
-
+
* TAO_IDL/be/be_provides.cpp:
* TAO_IDL/be/be_interface.cpp:
* TAO_IDL/be_include/be_interface.h:
* TAO_IDL/be_include/be_provides.h:
-
+
Factored common code generation into the appropriate nodes.
-
+
* TAO_IDL/narrow/narrow.cpp:
-
- Added port types to the group of types that can be
+
+ Added port types to the group of types that can be
transformed from scope to decl and vice versa.
-
+
* TAO_IDL/be/be_visitor_extended_port/extended_port.cpp:
* TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp:
* TAO_IDL/be/be_visitor_component/component_svh.cpp:
@@ -26,7 +40,7 @@ Tue Oct 13 15:36:48 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be_include/be_visitor_extended_port.h:
* TAO_IDL/be_include/be_visitor_extended_port/extended_port.h:
* TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h:
-
+
Added new files as includes, factored common visitor code into
base class, other minor changes.
diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst
index acf843bd175..72f2d80f479 100644
--- a/TAO/bin/tao_orb_tests.lst
+++ b/TAO/bin/tao_orb_tests.lst
@@ -167,6 +167,7 @@ TAO/tests/Bug_3695_Regression/run_test.pl:
TAO/tests/Bug_3701_Regression/run_test.pl:
TAO/tests/Bug_3743_Regression/run_test.pl: !NO_IFR !LabVIEW_RT !WinCE !FUZZ
TAO/tests/Bug_3746_Regression/run_test.pl:
+TAO/tests/Bug_3748_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !VxWorks !VxWorks_RTP !LynxOS !LabVIEW_RT !WinCE !FUZZ
TAO/tests/DIOP/run_test.pl: !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ
TAO/tests/DIOP/run_test_ipv6.pl: IPV6 !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ
TAO/tests/RTCORBA/Activate_Object_Multiple_ORBs/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST
diff --git a/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc b/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc
new file mode 100644
index 00000000000..fbab84719e4
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Bug_3748_Regression.mpc
@@ -0,0 +1,37 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl): taoidldefaults {
+ idlflags += -Sp
+ IDL_Files {
+ Test.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): taoserver {
+ after += *idl
+ Source_Files {
+ Hello.cpp
+ server.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ TestS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient {
+ after += *idl
+ Source_Files {
+ client.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ }
+ IDL_Files {
+ }
+}
+
diff --git a/TAO/tests/Bug_3748_Regression/Hello.cpp b/TAO/tests/Bug_3748_Regression/Hello.cpp
new file mode 100644
index 00000000000..409faf5ca1f
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Hello.cpp
@@ -0,0 +1,25 @@
+//
+// $Id$
+//
+#include "Hello.h"
+
+ACE_RCSID(Hello, Hello, "$Id$")
+
+Hello::Hello (CORBA::ORB_ptr orb, CORBA::ORB_ptr shutdown_orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+ , shutdown_orb_ (CORBA::ORB::_duplicate (shutdown_orb))
+{
+}
+
+char *
+Hello::get_string (void)
+{
+ return CORBA::string_dup ("Hello there!");
+}
+
+void
+Hello::shutdown (void)
+{
+ this->orb_->shutdown (0);
+ this->shutdown_orb_->shutdown (0);
+}
diff --git a/TAO/tests/Bug_3748_Regression/Hello.h b/TAO/tests/Bug_3748_Regression/Hello.h
new file mode 100644
index 00000000000..2546959336c
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Hello.h
@@ -0,0 +1,32 @@
+//
+// $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, CORBA::ORB_ptr shutdown_orb);
+
+ // = 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_;
+ CORBA::ORB_var shutdown_orb_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* HELLO_H */
diff --git a/TAO/tests/Bug_3748_Regression/Makefile.am b/TAO/tests/Bug_3748_Regression/Makefile.am
new file mode 100644
index 00000000000..a0e2286e095
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/Makefile.am
@@ -0,0 +1,105 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/ace_gperf
+TAO_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.Hello_Idl.am
+
+BUILT_SOURCES = \
+ TestC.cpp \
+ TestC.h \
+ TestC.inl \
+ TestS.cpp \
+ TestS.h \
+ TestS.inl
+
+CLEANFILES = \
+ Test-stamp \
+ TestC.cpp \
+ TestC.h \
+ TestC.inl \
+ TestS.cpp \
+ TestS.h \
+ TestS.inl
+
+TestC.cpp TestC.h TestC.inl TestS.cpp TestS.h TestS.inl: Test-stamp
+
+Test-stamp: $(srcdir)/Test.idl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St -Sp $(srcdir)/Test.idl
+ @touch $@
+
+noinst_HEADERS = \
+ Test.idl
+
+## Makefile.Hello_Client.am
+
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += client
+
+client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+client_SOURCES = \
+ TestC.cpp \
+ client.cpp \
+ Hello.h
+
+client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_EXCEPTIONS
+
+## Makefile.Hello_Server.am
+
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += server
+
+server_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+server_SOURCES = \
+ Hello.cpp \
+ TestC.cpp \
+ TestS.cpp \
+ server.cpp \
+ Hello.h
+
+server_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_EXCEPTIONS
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/tests/Bug_3748_Regression/README b/TAO/tests/Bug_3748_Regression/README
new file mode 100644
index 00000000000..1b68002f165
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/README
@@ -0,0 +1,5 @@
+// $Id$
+
+This test uses big value for -ORBIPHopLimit to simulate failure in
+TAO_IIOP_Connection_Handler::open(). Later could lead to connection
+handler leak.
diff --git a/TAO/tests/Bug_3748_Regression/Test.idl b/TAO/tests/Bug_3748_Regression/Test.idl
new file mode 100644
index 00000000000..3c0976e106d
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/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/Bug_3748_Regression/client.cpp b/TAO/tests/Bug_3748_Regression/client.cpp
new file mode 100644
index 00000000000..e99a5609346
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/client.cpp
@@ -0,0 +1,110 @@
+// $Id$
+
+#include "TestC.h"
+#include "ace/Get_Opt.h"
+
+ACE_RCSID(Hello, client, "$Id$")
+
+const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
+const ACE_TCHAR *shutdown_ior = ACE_TEXT ("file://shutdown_test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:s:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case 's':
+ shutdown_ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "-s <shutdown_ior>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var tmp = orb->string_to_object(ior);
+
+ 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",
+ ior),
+ 1);
+ }
+
+ int encountered_failures = 0;
+ for (int i = 0; i < 5000; ++i)
+ {
+ try
+ {
+ CORBA::String_var the_string = hello->get_string ();
+ }
+ catch (::CORBA::Exception const &)
+ {
+ if (++encountered_failures % 500 == 0)
+ {
+#if 0
+ ACE_DEBUG ((LM_DEBUG,
+ "Expected exception\n"));
+#endif
+ }
+ }
+ }
+
+ if (encountered_failures == 0)
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: No expected exceptions occured.\n"));
+
+ tmp = orb->string_to_object(shutdown_ior);
+
+ Test::Hello_var shutdown_hello = Test::Hello::_narrow(tmp.in ());
+
+ if (CORBA::is_nil (shutdown_hello.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Nil Test::Hello reference <%s>\n",
+ shutdown_ior),
+ 1);
+ }
+
+ shutdown_hello->shutdown ();
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tests/Bug_3748_Regression/run_test.pl b/TAO/tests/Bug_3748_Regression/run_test.pl
new file mode 100755
index 00000000000..3bb167be7ca
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/run_test.pl
@@ -0,0 +1,90 @@
+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;
+
+$status = 0;
+$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";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "server.ior";
+my $shutdown_iorbase = "shutdown.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+my $shutdown_server_iorfile = $server->LocalFile ($shutdown_iorbase);
+my $shutdown_client_iorfile = $client->LocalFile ($shutdown_iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+$server->DeleteFile($shutdown_iorbase);
+$client->DeleteFile($shutdown_iorbase);
+
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile -s $shutdown_server_iorfile");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -s file://$shutdown_client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
+
+if ($server->WaitForFileTimed ($shutdown_iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($server->GetFile ($shutdown_iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$shutdown_server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($shutdown_iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$shutdown_client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+$server->DeleteFile($shutdown_iorbase);
+$client->DeleteFile($shutdown_iorbase);
+
+exit $status;
diff --git a/TAO/tests/Bug_3748_Regression/server.cpp b/TAO/tests/Bug_3748_Regression/server.cpp
new file mode 100644
index 00000000000..c63c19b2539
--- /dev/null
+++ b/TAO/tests/Bug_3748_Regression/server.cpp
@@ -0,0 +1,203 @@
+// $Id$
+
+#include "Hello.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Task.h"
+#include "ace/ARGV.h"
+
+ACE_RCSID (Hello,
+ server,
+ "$Id$")
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior");
+const ACE_TCHAR *shutdown_ior_output_file = ACE_TEXT ("shutdown_test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:s:h"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case 's':
+ shutdown_ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case 'h':
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile> "
+ "-s <shutdown_iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+class Server_Task : public ACE_Task_Base
+{
+public:
+ /// Constructor
+ Server_Task (CORBA::ORB_ptr orb,
+ ACE_Thread_Manager *thr_mgr)
+ : ACE_Task_Base (thr_mgr)
+ , orb_ (CORBA::ORB::_duplicate (orb))
+ {
+ }
+
+ /// Thread entry point
+ int svc (void)
+ {
+ try
+ {
+ this->orb_->run ();
+ }
+ catch (const CORBA::Exception&)
+ {
+ return -1;
+ }
+ return 0;
+ }
+
+private:
+ /// Reference to the ORB
+ CORBA::ORB_var orb_;
+};
+
+int
+prepare_one_server (int argc, ACE_TCHAR *argv[],
+ ACE_TCHAR const *output_filename,
+ CORBA::ORB_out orb,
+ CORBA::ORB_ptr shutdown_orb,
+ PortableServer::POA_out root_poa,
+ Hello *&hello_impl)
+{
+ try
+ {
+ // Use output_filename as an ORB's name, just to
+ // obtain a unique ORB.
+ orb =
+ CORBA::ORB_init (argc, argv,
+ ACE_TEXT_ALWAYS_CHAR (output_filename));
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+
+ root_poa =
+ PortableServer::POA::_narrow (poa_object.in ());
+
+ if (CORBA::is_nil (root_poa))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Panic: nil RootPOA\n"),
+ 1);
+
+ PortableServer::POAManager_var poa_manager = root_poa->the_POAManager ();
+
+ ACE_NEW_RETURN (hello_impl,
+ Hello (orb, shutdown_orb),
+ 1);
+
+ 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 = orb->object_to_string (hello.in ());
+
+ // Output the IOR to the <output_filename>
+ FILE *output_file= ACE_OS::fopen (output_filename, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s\n",
+ output_filename),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ poa_manager->activate ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ ACE_ARGV_T<ACE_TCHAR> saved;
+ for (int i = 0; i < argc; ++i)
+ {
+ saved.add (argv[i]);
+ }
+ saved.add (ACE_TEXT ("-ORBIPHopLimit"));
+ saved.add (ACE_TEXT ("10000"));
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::ORB_var orb;
+ CORBA::ORB_out orb_param (orb);
+ PortableServer::POA_var root_poa;
+ PortableServer::POA_out root_poa_param (root_poa);
+
+ Hello *hello_impl = 0;
+ if (prepare_one_server (saved.argc (), saved.argv (), ior_output_file,
+ orb_param, CORBA::ORB::_nil (), root_poa_param, hello_impl))
+ return 1;
+ PortableServer::ServantBase_var owner_transfer(hello_impl);
+
+ CORBA::ORB_var shutdown_orb;
+ CORBA::ORB_out shutdown_orb_param (shutdown_orb);
+ PortableServer::POA_var shutdown_root_poa;
+ PortableServer::POA_out shutdown_root_poa_param (shutdown_root_poa);
+
+ Hello *shutdown_hello_impl = 0;
+ if (prepare_one_server (argc, argv, shutdown_ior_output_file,
+ shutdown_orb_param, orb.in (),
+ shutdown_root_poa_param,
+ shutdown_hello_impl))
+ return 1;
+ PortableServer::ServantBase_var shutdown_owner_transfer(shutdown_hello_impl);
+
+ Server_Task server_task (shutdown_orb.in (),
+ ACE_Thread_Manager::instance ());
+ if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "Error activating server task\n"));
+ }
+
+ orb->run ();
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
+ root_poa->destroy (1, 1);
+ orb->destroy ();
+
+ ACE_Thread_Manager::instance ()->wait ();
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutdown server - event loop finished\n"));
+ shutdown_root_poa->destroy (1, 1);
+ shutdown_orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}