summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2014-09-12 14:23:55 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2014-09-12 14:23:55 +0000
commit4603fb929cff102ff3cbbca760b8483d1a329ee2 (patch)
tree33f836f03d2313e48415444667ab2fa1cfb6ef7b
parentd46afcea703c6a5cd70118d25fa6a1d8157a6e56 (diff)
downloadATCD-4603fb929cff102ff3cbbca760b8483d1a329ee2.tar.gz
Fri Sep 12 14:10:47 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/ImplRepo_Service/Activator_Options.cpp: * orbsvcs/ImplRepo_Service/Locator_Options.cpp: Set the default debug level to be 0 rather than 1. Services should be quiet by default. * orbsvcs/ImplRepo_Service/ImR_Activator.idl: * orbsvcs/ImplRepo_Service/ImR_Activator_i.h: * orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp: * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: * orbsvcs/ImplRepo_Service/Locator_Repository.h: * orbsvcs/ImplRepo_Service/Locator_Repository.cpp: * orbsvcs/ImplRepo_Service/Shared_Backing_Store.h: Add an enhancement to allow a restarted IMR Locator verify that servers * orbsvcs/tests/ImplRepo/RestartIMR: * bin/tao_other_tests.lst: Add new test to verify the feature. * orbsvcs/tests/ImplRepo/servers_list/run_test.pl: Fix a typo.
-rw-r--r--TAO/ChangeLog24
-rw-r--r--TAO/bin/tao_other_tests.lst2
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp2
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImR_Activator.idl3
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp19
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h4
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp80
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp2
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Locator_Repository.cpp1
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Locator_Repository.h6
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Shared_Backing_Store.h11
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/RestartIMR.mpc26
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl301
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/server.cpp130
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/test.idl15
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.cpp51
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.h48
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl2
18 files changed, 698 insertions, 29 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index cc5dcda64e9..ff9c651405b 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,27 @@
+Fri Sep 12 14:10:47 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * orbsvcs/ImplRepo_Service/Activator_Options.cpp:
+ * orbsvcs/ImplRepo_Service/Locator_Options.cpp:
+ Set the default debug level to be 0 rather than 1.
+ Services should be quiet by default.
+
+ * orbsvcs/ImplRepo_Service/ImR_Activator.idl:
+ * orbsvcs/ImplRepo_Service/ImR_Activator_i.h:
+ * orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp:
+ * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp:
+ * orbsvcs/ImplRepo_Service/Locator_Repository.h:
+ * orbsvcs/ImplRepo_Service/Locator_Repository.cpp:
+ * orbsvcs/ImplRepo_Service/Shared_Backing_Store.h:
+ Add an enhancement to allow a restarted IMR Locator verify that
+ servers
+
+ * orbsvcs/tests/ImplRepo/RestartIMR:
+ * bin/tao_other_tests.lst:
+ Add new test to verify the feature.
+
+ * orbsvcs/tests/ImplRepo/servers_list/run_test.pl:
+ Fix a typo.
+
Thu Sep 11 10:50:18 UTC 2014 Johnny Willemsen <jwillemsen@remedy.nl>
* TAO_IDL/be/be_visitor_connector/executor_ami_exs.cpp:
diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst
index db38b1bbb20..e9bb26ae350 100644
--- a/TAO/bin/tao_other_tests.lst
+++ b/TAO/bin/tao_other_tests.lst
@@ -151,6 +151,8 @@ TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl -hide_server
TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl -multistart: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS
TAO/orbsvcs/tests/ImplRepo/ping_interrupt/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS
TAO/orbsvcs/tests/ImplRepo/link_poas/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS
+TAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS
+TAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl -kill_server: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS
TAO/orbsvcs/examples/ImR/Combined_Service/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ST !ACE_FOR_TAO !LynxOS !WCHAR
TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !WCHAR
TAO/orbsvcs/tests/CosEvent/Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !NO_MESSAGING !ACE_FOR_TAO !LynxOS
diff --git a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp
index 4bcc0f023be..22332d4b778 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp
@@ -21,7 +21,7 @@ static const ACE_TCHAR *SERVICE_REG_PATH =
#endif /* ACE_WIN32 */
Activator_Options::Activator_Options ()
-: debug_ (1)
+: debug_ (0)
, service_ (false)
, notify_imr_ (false)
, induce_delay_ (0)
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator.idl b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator.idl
index e9c2ca458dc..cb60e0851e8 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator.idl
+++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator.idl
@@ -19,6 +19,9 @@ module ImplementationRepository
{
/// Tells the activator to send a signal to a child process
boolean kill_server (in string name, in long pid, in short signum);
+
+ /// Check if the pid is still alive
+ boolean still_alive (in long pid);
};
};
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp
index 5e76b88ddb2..2c9be7052b2 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp
@@ -349,8 +349,23 @@ ImR_Activator_i::kill_server (const char* name, CORBA::Long lastpid, CORBA::Shor
return result == 0;
}
+CORBA::Boolean
+ImR_Activator_i::still_alive (CORBA::Long pid)
+{
+ pid_t pt = static_cast<pid_t>(pid);
+ bool is_running = this->process_map_.find (pt) == 0;
+#if defined (ACE_WIN32)
+ if (is_running)
+ {
+ pid_t waitp = this->process_mgr_.wait (pt, ACE_Time_Value::zero);
+ is_running = (waitp != pt);
+ }
+#endif /* ACE_WIN32 */
+ return is_running;
+}
+
bool
-ImR_Activator_i::still_running (const char *name)
+ImR_Activator_i::still_running_i (const char *name)
{
bool is_running = this->server_list_.find (name) == 0;
#if defined (ACE_WIN32)
@@ -396,7 +411,7 @@ ImR_Activator_i::start_server(const char* name,
"ImR Activator: Starting %s <%s>...\n",
(unique ? "unique server" : "server"), name));
- if (unique && this->still_running (name))
+ if (unique && this->still_running_i (name))
{
if (debug_ > 1)
ORBSVCS_DEBUG((LM_DEBUG,
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h
index dc4d6468696..ef0495b25bd 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h
+++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h
@@ -70,6 +70,8 @@ class Activator_Export ImR_Activator_i : public POA_ImplementationRepository::Ac
CORBA::Boolean kill_server (const char* name, CORBA::Long pid, CORBA::Short signum);
+ CORBA::Boolean still_alive (CORBA::Long pid);
+
void shutdown(void);
/// Initialize the Server state - parsing arguments and waiting.
@@ -97,7 +99,7 @@ private:
int handle_exit (ACE_Process * process);
int handle_exit_i (pid_t pid);
- bool still_running (const char *name);
+ bool still_running_i (const char *name);
private:
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
index d112e77bcc8..aa4e3b75939 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
@@ -172,27 +172,79 @@ ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts)
int result = this->repository_->init(this->root_poa_.in (),
this->imr_poa_.in (),
ior);
- if (result == 0)
+ if (result != 0)
{
- Locator_Repository::SIMap::ENTRY* entry = 0;
- Locator_Repository::SIMap::ITERATOR it (this->repository_->servers ());
+ return result;
+ }
- for (;it.next (entry) != 0; it.advance ())
+ Locator_Repository::SIMap::ENTRY* entry = 0;
+ Locator_Repository::SIMap::ITERATOR it (this->repository_->servers ());
+
+ for (;it.next (entry) != 0; it.advance ())
+ {
+ Server_Info& info = *(entry->int_id_);
+ Server_Info *active = info.active_info ();
+ ImplementationRepository::ServerObject_var svrobj = active->server;
+ bool is_alive = !CORBA::is_nil (svrobj.in()) &&
+ !this->pinger_.has_server (info.ping_id());
+ if (this->debug_ > 0)
+ {
+ ORBSVCS_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("step 1: %C alive? %d pid = %d\n"),
+ info.ping_id (), is_alive, active->pid));
+ }
+ if (active->pid > 0)
{
- const Server_Info& info = *(entry->int_id_);
- ImplementationRepository::ServerObject_var svrobj =
- info.alt_info_.null () ? info.server : info.alt_info_->server;
- if (!CORBA::is_nil (svrobj.in()) &&
- !this->pinger_.has_server (info.ping_id()))
+ Activator_Info_Ptr ainfo =
+ this->get_activator (active->activator);
+
+ if (ainfo.null () ||
+ CORBA::is_nil (ainfo->activator.in ()))
{
- this->pinger_.add_server (info.ping_id(),
- this->ping_external_,
- svrobj.in());
+ if (this->debug_ > 0)
+ {
+ ORBSVCS_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("step 2: no activator\n")));
+ }
+ is_alive = false;
}
+ else
+ {
+ ImplementationRepository::ActivatorExt_var actx =
+ ImplementationRepository::ActivatorExt::_narrow (ainfo->activator.in ());
+ try
+ {
+ is_alive = !CORBA::is_nil (actx.in ()) &&
+ actx->still_alive (active->pid);
+ }
+ catch (CORBA::Exception &)
+ {
+ is_alive = false;
+ }
+ if (this->debug_ > 0)
+ {
+ ORBSVCS_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("step 3: activator says alive = %d\n"),
+ is_alive));
+ }
+ }
+ }
+
+ if (is_alive)
+ {
+ this->pinger_.add_server (info.ping_id(),
+ active->pid > 0 || this->ping_external_,
+ svrobj.in());
+ }
+ else
+ {
+ active->reset_runtime ();
}
+
}
- return result;
+ //only after verifying do we report the IOR and become open for business
+ return this->repository_->report_ior(this->imr_poa_.in ());
}
int
@@ -265,7 +317,7 @@ ImR_Locator_i::shutdown
{
Activator_Info_Ptr info = entry->int_id_;
ACE_ASSERT (! info.null ());
- connect_activator (*info);
+ this->connect_activator (*info);
if (! CORBA::is_nil (info->activator.in ()))
acts.push_back (info->activator);
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp
index 26298dac293..c0d33fee8f5 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp
@@ -26,7 +26,7 @@ static const int DEFAULT_START_TIMEOUT = 60; // seconds
Options::Options ()
: repo_mode_ (REPO_NONE)
, erase_repo_ (false)
-, debug_ (1)
+, debug_ (0)
, multicast_ (false)
, service_ (false)
, ping_external_ (false)
diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.cpp
index af612b9bf4c..410f6acef84 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.cpp
@@ -46,7 +46,6 @@ Locator_Repository::init (PortableServer::POA_ptr root_poa,
poaman = imr_poa->the_POAManager ();
poaman->activate ();
- err = report_ior(imr_poa);
return err;
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.h b/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.h
index 2b0dff773ba..617837e5526 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.h
+++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Repository.h
@@ -132,6 +132,9 @@ public:
/// Indicate if multicast should be used
bool multicast() const;
+ /// report the ImR Locator's IOR
+ virtual int report_ior (PortableServer::POA_ptr imr_poa);
+
protected:
/// perform repo mode specific initialization
virtual int init_repo (PortableServer::POA_ptr imr_poa) = 0;
@@ -150,9 +153,6 @@ protected:
/// perform persistent remove
virtual int persistent_remove (const ACE_CString& name, bool activator) = 0;
- /// report the ImR Locator's IOR
- virtual int report_ior (PortableServer::POA_ptr imr_poa);
-
/// recover the ImR Locator's IOR from the persisted file
virtual int recover_ior (void);
diff --git a/TAO/orbsvcs/ImplRepo_Service/Shared_Backing_Store.h b/TAO/orbsvcs/ImplRepo_Service/Shared_Backing_Store.h
index fe213a3069b..54867415c1b 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Shared_Backing_Store.h
+++ b/TAO/orbsvcs/ImplRepo_Service/Shared_Backing_Store.h
@@ -131,6 +131,12 @@ public:
long token,
const ACE_CString& ior,
const NameValues& extra_params);
+
+ /// calls Locator_Repository::report_ior with the Fault Tolerant ImR
+ /// Locator's IOR if available, otherwise reporting the ior is delayed
+ /// until the peer replica registers with this replica
+ virtual int report_ior(PortableServer::POA_ptr imr_poa);
+
protected:
/// perform shared backing store specific initialization
/// (activates this Shared_Backing_Store as the "ImR_Replica",
@@ -152,11 +158,6 @@ protected:
/// uses sync_needed_ and sync_files_ to determine what to update
virtual int sync_load ();
- /// calls Locator_Repository::report_ior with the Fault Tolerant ImR
- /// Locator's IOR if available, otherwise reporting the ior is delayed
- /// until the peer replica registers with this replica
- virtual int report_ior(PortableServer::POA_ptr imr_poa);
-
/// create the Fault Tolerant ImR Locator IOR, using the peer_ior and
/// this ImR Locator's IOR
char* locator_service_ior(const char* peer_ior) const;
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/RestartIMR.mpc b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/RestartIMR.mpc
new file mode 100755
index 00000000000..366986b9076
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/RestartIMR.mpc
@@ -0,0 +1,26 @@
+// $Id$
+//
+// Really the server is the only one that needs to avoid minimum_corba and
+// the lot. But there's no sense in building anything if you can't build
+// the server.
+
+project(*idl): taoidldefaults, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro {
+ custom_only = 1
+ IDL_Files {
+ test.idl
+ }
+}
+
+project(*server): taoserver, imr_client, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro {
+ exename = server
+ after += *idl
+ IDL_Files {
+ }
+ Source_Files {
+ testC.cpp
+ testS.cpp
+ server.cpp
+ test_i.cpp
+ }
+}
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl
new file mode 100755
index 00000000000..aa104160af4
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/run_test.pl
@@ -0,0 +1,301 @@
+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;
+
+my $tgt_num = 0;
+my $imr = PerlACE::TestTarget::create_target (++$tgt_num) || die "Create target $tgt_num failed\n";
+my $act = PerlACE::TestTarget::create_target (++$tgt_num) || die "Create target $tgt_num failed\n";
+my $ti = PerlACE::TestTarget::create_target (++$tgt_num) || die "Create target $tgt_num failed\n";
+my $srv = PerlACE::TestTarget::create_target (++$tgt_num) || die "Create target $tgt_num failed\n";
+
+my $port = $imr->RandomPort ();
+my $srv_id = "AAA";
+my $srv_id_cmd = "-ORBServerId AAA ";
+my $ping_ext = "-v 0 ";
+my $server_pid = 0;
+
+my $kill_svr = 0;
+my $kill_act = 0;
+
+my $imr_debug = "-d 1 ";
+my $act_debug = "";
+my $srv_debug = "";
+my $clt_debug = "";
+
+foreach my $i (@ARGV) {
+ if ($i eq '-debug') {
+ $imr_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile imr.log -d 5 ";
+ $act_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile act.log -d 5 ";
+ $srv_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile srv.log ";
+ }
+ elsif ($i eq '-kill_act') {
+ $kill_act = 1;
+ $kill_svr = 1;
+ }
+ elsif ($i eq '-kill_server') {
+ $kill_svr = 1;
+ }
+ elsif ($i eq '-noid') {
+ $srv_id = "";
+ $srv_id_cmd = "";
+ }
+ elsif ($i eq '-pingexternal') {
+ $ping_ext = "-i ";
+ }
+ else {
+ print STDERR "unrecognized argument $i\n";
+ exit 1;
+ }
+}
+
+my $imriorfile = "imr_locator.ior";
+my $imrlogfile = "imr.log";
+my $actiorfile = "imr_activator.ior";
+my $actlogfile = "act.log";
+my $srvlogfile = "srv.log";
+my $srvpidfile = "server.pid";
+my $persist_dir = "persist";
+
+my $imr_imriorfile = $imr->LocalFile ($imriorfile);
+my $act_imriorfile = $act->LocalFile ($imriorfile);
+my $act_actiorfile = $act->LocalFile ($actiorfile);
+my $srv_imriorfile = $srv->LocalFile ($imriorfile);
+my $srv_srvpidfile = $srv->LocalFile ($srvpidfile);
+my $ti_imriorfile = $ti->LocalFile ($imriorfile);
+
+
+sub get_server_pid
+{
+ my $pid = 0;
+ open (FILE, $srv_srvpidfile) or die "Can't open server.pid: $!";
+ while (<FILE>) {
+ chomp;
+ $pid = $_;
+ $server_pid = $pid if ($server_pid == 0);
+ }
+ close FILE;
+ return $pid;
+}
+
+sub signal_server
+{
+ my $sig = shift;
+ print "signal $sig to server $server_pid\n";
+ kill ($sig, $server_pid);
+}
+
+
+sub delete_files
+{
+ my $logs_too = shift;
+ if ($logs_too == 1) {
+ $imr->DeleteFile ($imrlogfile);
+ $act->DeleteFile ($actlogfile);
+ $srv->DeleteFile ($srvlogfile);
+ }
+ $imr->DeleteFile ($imriorfile);
+ $act->DeleteFile ($imriorfile);
+ $act->DeleteFile ($actiorfile);
+ $ti->DeleteFile ($imriorfile);
+ $srv->DeleteFile ($imriorfile);
+ $srv->DeleteFile ($srvpidfile);
+
+ unlink <persist/*>;
+ rmdir $persist_dir;
+}
+
+# Clean up after exit call
+END
+{
+ delete_files (0);
+}
+
+delete_files (1);
+
+mkdir $persist_dir;
+
+$IMR = $imr->CreateProcess ("../../../ImplRepo_Service/tao_imr_locator",
+ "-ORBEndpoint iiop://:$port ".
+ "-UnregisterIfAddressReused $imr_debug".
+ "--directory $persist_dir " .
+ $ping_ext .
+ "-o $imr_imriorfile ");
+
+$ACT = $act->CreateProcess ("../../../ImplRepo_Service/tao_imr_activator",
+ "-l $act_debug -o $act_actiorfile " .
+ "-ORBInitRef ImplRepoService=file://$act_imriorfile");
+
+my $srv_args = "-ORBInitRef ImplRepoService=file://$srv_imriorfile -ORBUseIMR 1 ".
+ $srv_id_cmd . $srv_debug;
+
+$SRV = $srv->CreateProcess ("server", $srv_args);
+
+my $poaA = "$srv_id:poaA";
+my $poaC = "$srv_id:poaC";
+
+my $srv_cmd = $act->LocalFile ($SRV->Executable());
+
+$TI = $ti->CreateProcess ("../../../ImplRepo_Service/tao_imr",
+ "-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "add $poaA -c \"$srv_cmd $srv_args\"");
+
+print STDERR "=== start Locator\n";
+print STDERR $IMR->CommandLine () . "\n";
+$IMR_status = $IMR->Spawn ();
+if ($IMR_status != 0) {
+ print STDERR "ERROR: ImplRepo Service returned $IMR_status\n";
+ exit 1;
+}
+if ($imr->WaitForFileTimed ($imriorfile,$imr->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$imr_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+
+if ($imr->GetFile ($imriorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$imr_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($imriorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+if ($act->PutFile ($imriorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$act_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+if ($ti->PutFile ($imriorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$ti_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+
+print STDERR "=== start Activator\n";
+$ACT_status = $ACT->Spawn ();
+if ($ACT_status != 0) {
+ print STDERR "ERROR: ImR Activator returned $ACT_status\n";
+ exit 1;
+}
+if ($act->WaitForFileTimed ($actiorfile,$act->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$act_imriorfile>\n";
+ $ACT->Kill (); $ACT->TimedWait (1);
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+
+print STDERR "=== Registering POAs\n";
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr register poaA returned $TI_status\n";
+}
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "link $poaA -p poaC");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr link poaC to poaA returned $TI_status\n";
+}
+
+print STDERR "=== start server\n";
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "start $poaA");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr list returned $TI_status\n";
+}
+if ($srv->GetFile ($srvpidfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srvpidfile>\n";
+}
+
+print STDERR "=== list pre-kill\n";
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "list -v");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr list poaC to poaA returned $TI_status\n";
+}
+
+print STDERR "=== kill ImR Locator\n";
+$IMR_status = $IMR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
+$imr->DeleteFile ($imriorfile);
+
+if ($kill_act == 1) {
+ print STDERR "=== kill ImR Activator\n";
+ $ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval());
+ $act->DeleteFile ($actiorfile);
+}
+
+if ($kill_svr == 1) {
+ print STDERR "=== kill server\n";
+ get_server_pid ();
+ signal_server ("KILL");
+ $srv->DeleteFile ($srvpidfile);
+}
+
+print STDERR "=== restart ImR Locator\n";
+$IMR_status = $IMR->Spawn ();
+if ($IMR_status != 0) {
+ print STDERR "ERROR: ImplRepo Service returned $IMR_status\n";
+ exit 1;
+}
+if ($imr->WaitForFileTimed ($imriorfile,$imr->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$imr_imriorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ exit 1;
+}
+
+if ($kill_act == 1) {
+ print STDERR "=== restart ImR Activator\n";
+ $ACT_status = $ACT->Spawn ();
+ if ($ACT_status != 0) {
+ print STDERR "ERROR: ImplRepo Service returned $ACT_status\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ $ACT->Kill (); $ACT->TimedWait (1);
+ exit 1;
+ }
+ if ($act->WaitForFileTimed ($actiorfile,$act->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$act_actiorfile>\n";
+ $IMR->Kill (); $IMR->TimedWait (1);
+ $ACT->Kill (); $ACT->TimedWait (1);
+ exit 1;
+ }
+}
+
+print STDERR "=== restart server via ImR\n";
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "start $poaA ");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr start $poaA returned $TI_status\n";
+}
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "list -v");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr list returned $TI_status\n";
+}
+
+$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
+ "shutdown $poaA ");
+$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
+if ($TI_status != 0) {
+ print STDERR "tao_imr shutdown $poaA returned $TI_status\n";
+}
+
+$ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval());
+
+$IMR_status = $IMR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/server.cpp b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/server.cpp
new file mode 100755
index 00000000000..107828cff59
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/server.cpp
@@ -0,0 +1,130 @@
+// $Id$
+#include "test_i.h"
+#include "tao/ImR_Client/ImR_Client.h"
+#include <ace/Task.h>
+#include <ace/Get_Opt.h>
+
+const ACE_TCHAR * pid_file = ACE_TEXT ("server.pid");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("p:"));
+ int c;
+
+
+ while ((c = get_opts ()) != -1)
+ {
+ switch (c)
+ {
+ case 'p':
+ pid_file = get_opts.opt_arg ();
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %s ")
+ ACE_TEXT ("-p <iorfile>")
+ ACE_TEXT ("\n"),
+ argv [0]),
+ -1);
+ }
+ }
+
+ 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 object =
+ orb->resolve_initial_references ("RootPOA");
+ PortableServer::POA_var rootPOA =
+ PortableServer::POA::_narrow (object.in ());
+ PortableServer::POAManager_var poa_manager =
+ rootPOA->the_POAManager ();
+
+ CORBA::PolicyList policies (5);
+ policies.length (5);
+
+ // Lifespan policy
+ policies[0] =
+ rootPOA->create_lifespan_policy (PortableServer::PERSISTENT);
+
+ // Servant Retention Policy
+ policies[1] =
+ rootPOA->create_servant_retention_policy (PortableServer::RETAIN );
+
+ // ID Assignment Policy
+ policies[2] =
+ rootPOA->create_id_assignment_policy (PortableServer::USER_ID );
+
+ // Request Processing Policy
+ policies[3] =
+ rootPOA->create_request_processing_policy (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY );
+
+ // Threading policy
+ policies[4] =
+ rootPOA->create_thread_policy (PortableServer::ORB_CTRL_MODEL);
+
+ PortableServer::POA_var poa_a = rootPOA->create_POA ("poaA",
+ poa_manager.in (),
+ policies
+ );
+ PortableServer::POA_var poa_c = rootPOA->create_POA ("poaC",
+ poa_manager.in (),
+ policies
+ );
+
+ for (CORBA::ULong i = 0;
+ i < policies.length ();
+ ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ policy->destroy ();
+ }
+
+ Test_Time_i* time = new Test_Time_i();
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId ("Server_A");
+ poa_a->activate_object_with_id (oid.in (), time);
+ CORBA::Object_var time_obj = poa_a->id_to_reference(oid.in());
+ CORBA::String_var ior =
+ orb->object_to_string (time_obj.in ());
+
+ poa_manager->activate ();
+
+ FILE *output_file = ACE_OS::fopen (pid_file, ACE_TEXT ("w"));
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Cannot open output file for writing IOR: %s\n"),
+ pid_file),
+ 1);
+
+ ACE_OS::fprintf (output_file, "%d\n", ACE_OS::getpid ());
+ ACE_OS::fclose (output_file);
+
+ orb->run ();
+
+ rootPOA->destroy (1, 1);
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ ex._tao_print_exception (ACE_TEXT ("server:"));
+ return 1;
+ }
+
+ return 0;
+}
+
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test.idl b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test.idl
new file mode 100755
index 00000000000..3e16ed854f5
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test.idl
@@ -0,0 +1,15 @@
+// $Id$
+module Test
+{
+ interface Dummy
+ {
+ string getMessage();
+ };
+
+ interface Time
+ {
+ long current_time ();
+ oneway void shutdown ();
+ };
+
+};
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.cpp b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.cpp
new file mode 100755
index 00000000000..0487df28e12
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.cpp
@@ -0,0 +1,51 @@
+// $Id$
+#include "test_i.h"
+#include "ace/OS_NS_time.h"
+
+
+// Implementation skeleton constructor
+Test_Dummy_i::Test_Dummy_i (void)
+{
+}
+
+// Implementation skeleton destructor
+Test_Dummy_i::~Test_Dummy_i (void)
+{
+}
+
+char * Test_Dummy_i::getMessage (
+ void
+ )
+{
+ // Add your implementation here
+ return CORBA::string_dup("Test::Dummy---->Hello World");
+}
+
+Test_Time_i::Test_Time_i (void)
+{
+}
+
+// Implementation skeleton destructor
+Test_Time_i::~Test_Time_i (void)
+{
+}
+
+::CORBA::Long Test_Time_i::current_time (
+ void
+ )
+{
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t)Test_Time_i::current_time called\n"));
+ return CORBA::Long (ACE_OS::time (0));
+}
+
+void Test_Time_i::shutdown (
+ void
+ )
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%s\n",
+ "Time_i is shutting down"));
+
+}
+
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.h b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.h
new file mode 100755
index 00000000000..4c0e0ef2ceb
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/RestartIMR/test_i.h
@@ -0,0 +1,48 @@
+// $Id$
+#ifndef IMR_RECONNECTSERVER_H
+#define IMR_RECONNECTSERVER_H
+
+#include "testS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+class Test_Dummy_i
+ : public virtual POA_Test::Dummy
+{
+public:
+ // Constructor
+ Test_Dummy_i (void);
+
+ // Destructor
+ virtual ~Test_Dummy_i (void);
+
+ virtual char * getMessage (void);
+};
+
+class Test_Time_i
+ : public virtual POA_Test::Time
+{
+public:
+ // Constructor
+ Test_Time_i (void);
+
+ // Destructor
+ virtual ~Test_Time_i (void);
+
+ virtual
+ ::CORBA::Long current_time (
+ void
+ );
+
+ virtual
+ void shutdown (
+ void
+ );
+};
+
+
+#endif /* IMR_RECONNECTSERVER_H */
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl
index ab1d15ac633..5393ca5f3c0 100755
--- a/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl
+++ b/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl
@@ -178,7 +178,7 @@ sub servers_setup ()
$TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
"add $objprefix" . '_' . $i . " -c \"".
$srv_server_cmd[i].
- " -ORBUseIMR 1d -n $i -d $server_init_delay ".
+ " -ORBUseIMR 1 -n $i -d $server_init_delay ".
"-ORBInitRef ImplRepoService=file://$imr_imriorfile\"");
$TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());