diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-12 16:14:04 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-12 16:14:04 +0000 |
commit | 4ac3f09c148e9d7536ed4a243e7dc468673fda4d (patch) | |
tree | a5eba0ad0d92876cfa99ecefcafff4a1df2d8e65 | |
parent | 8da86b6d203c2df911220e6ebfcf70b803bd63b4 (diff) | |
download | ATCD-4ac3f09c148e9d7536ed4a243e7dc468673fda4d.tar.gz |
ChangeLogTag: Thu Mar 12 15:57:15 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu>
-rw-r--r-- | CIAO/ChangeLog | 20 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/FTComponents.mpc | 15 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp | 6 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.h | 2 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.cpp | 54 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.h | 65 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/Worker.idl | 1 | ||||
-rw-r--r-- | CIAO/DAnCE/tests/CIAO/FTComponents/killtask.cpp | 66 | ||||
-rw-r--r-- | CIAO/ciao/FTComponentServer/CIAO_FTComponentServer.cpp | 26 |
9 files changed, 242 insertions, 13 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 7f4923a66ce..4788e90666d 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,23 @@ +Thu Mar 12 15:57:15 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + + * DAnCE/tests/CIAO/FTComponents/Worker.idl + * DAnCE/tests/CIAO/FTComponents/FTTask_exec.h + * DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp + * DAnCE/tests/CIAO/FTComponents/Failure_Task.h + * DAnCE/tests/CIAO/FTComponents/Failure_Task.cpp + * DAnCE/tests/CIAO/FTComponents/FTComponents.mpc: + + Added new class that allows concurrent shutdown of a component. + + * DAnCE/tests/CIAO/FTComponents/killtask.cpp: + + Wrote executable to shutdown component through its Worker::stop + method. + + * ciao/FTComponentServer/CIAO_FTComponentServer.cpp: + + relocated AppSideMonitor_Thread activation. + Mon Mar 9 17:27:48 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> * DAnCE/FaultCorrelationManager/FaultCorrelationManager_Impl.h diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/FTComponents.mpc b/CIAO/DAnCE/tests/CIAO/FTComponents/FTComponents.mpc index 42af9cd517a..0a306d5b40b 100644 --- a/CIAO/DAnCE/tests/CIAO/FTComponents/FTComponents.mpc +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/FTComponents.mpc @@ -221,11 +221,13 @@ project(FTTask_exec) : ciao_executor, ciao_container_base, naming, orbsvcslib, c Source_Files { FTTaskEC.cpp FTTask_exec.cpp + Failure_Task.cpp } Header_Files { FTTaskEC.h FTTask_exec.h + Failure_Task.h FTTask_exec_export.h } @@ -266,3 +268,16 @@ project(FTTask_svnt) : ciao_servant, naming, ciao_lib { FTTaskS.inl } } + +project(killtask) : naming, ciao { + + after += Worker + libs += Worker + + IDL_Files { + } + + Source_Files { + killtask.cpp + } +}
\ No newline at end of file diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp b/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp index e655db44cef..de2f81b30d3 100644 --- a/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.cpp @@ -81,6 +81,12 @@ namespace CIDL_FTTask_Impl end - start)); } + void + FTTask_exec_i::stop (void) + { + ACE_OS::exit (1); + } + void FTTask_exec_i::set_state ( const ::CORBA::Any & state_value) diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.h b/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.h index 67a385700fa..6bf255b6c47 100644 --- a/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.h +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/FTTask_exec.h @@ -49,6 +49,8 @@ namespace CIDL_FTTask_Impl run_task ( ::CORBA::Double execution_time); + virtual void stop (void); + virtual void set_state ( const ::CORBA::Any & state_value); diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.cpp b/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.cpp new file mode 100644 index 00000000000..dc66d661064 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.cpp @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Failure_Task.cpp + * + * $Id$ + * + * @author Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + */ +//============================================================================= + +#include "Failure_Task.h" + +Failure_Task::Failure_Task (CORBA::ORB_ptr orb, + long limit, + long & count) + : condition_ (lock_), + orb_ (CORBA::ORB::_duplicate (orb)), + limit_ (limit), + count_ (count), + stop_ (false) +{ +} + +int +Failure_Task::svc (void) +{ + ACE_Guard <ACE_Thread_Mutex> guard (lock_); + + while (((limit_ == 0) || (count_ < limit_)) && !stop_) + { + condition_.wait (); + } + + // don't call shutdown on regular stop + if (!stop_) + orb_->shutdown (); + + return 0; +} + +void +Failure_Task::signal (void) +{ + condition_.signal (); +} + +void +Failure_Task::stop (void) +{ + stop_ = true; + condition_.signal (); +} diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.h b/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.h new file mode 100644 index 00000000000..0c9309f016b --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/Failure_Task.h @@ -0,0 +1,65 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Failure_Task.h + * + * $Id$ + * + * @author Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef FAILURE_TASK_H_ +#define FAILURE_TASK_H_ + +#include "ace/Condition_T.h" +#include "ace/Task.h" +#include "tao/ORB.h" + +/** + * @class Failure_Task + * + * @brief Active object that can be notified to simulate an + * application crash by shutting down the ORB. + */ + +class Failure_Task : public ACE_Task_Base +{ + public: + /// constructor + Failure_Task (CORBA::ORB_ptr orb, + long limit, + long & count); + + int svc (void); + + /// signals the internal condition + void signal (void); + + /// stops the thread by signaling the condition + void stop (void); + + private: + /// lock for condition variable + ACE_Thread_Mutex lock_; + + /// This condition variable is used for signalling changes of the + /// count + ACE_Condition <ACE_Thread_Mutex> condition_; + + /// ORB reference + CORBA::ORB_var orb_; + + /// limit that the count has to reach to provoke a failure + /// Zero means there is no limit and no failure will occure + long limit_; + + /// invocation count + long & count_; + + /// flag that indicates that the thread should be shut down + bool stop_; +}; + +#endif /* FAILURE_TASK_H_ */ diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/Worker.idl b/CIAO/DAnCE/tests/CIAO/FTComponents/Worker.idl index 0d3af16e3b7..902af4cb3bd 100644 --- a/CIAO/DAnCE/tests/CIAO/FTComponents/Worker.idl +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/Worker.idl @@ -3,5 +3,6 @@ module DeCoRAM interface Worker { void run_task (in double execution_time); + void stop (); }; }; diff --git a/CIAO/DAnCE/tests/CIAO/FTComponents/killtask.cpp b/CIAO/DAnCE/tests/CIAO/FTComponents/killtask.cpp new file mode 100644 index 00000000000..4aba79e20ed --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/FTComponents/killtask.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#include "WorkerC.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *first_ior = ACE_TEXT ("file://first.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + first_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 +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(first_ior); + + DeCoRAM::Worker_var worker = DeCoRAM::Worker::_narrow(tmp.in ()); + + if (CORBA::is_nil (worker.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Worker reference <%s>\n", + first_ior), + 1); + } + + worker->stop (); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/CIAO/ciao/FTComponentServer/CIAO_FTComponentServer.cpp b/CIAO/ciao/FTComponentServer/CIAO_FTComponentServer.cpp index 977eeadeb02..8dcef805233 100644 --- a/CIAO/ciao/FTComponentServer/CIAO_FTComponentServer.cpp +++ b/CIAO/ciao/FTComponentServer/CIAO_FTComponentServer.cpp @@ -130,6 +130,19 @@ namespace CIAO AppOptions::instance ()->process_id (this->get_process_id ()); AppOptions::instance ()->orb (CORBA::ORB::_duplicate (orb_.in ())); + CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task - " + "starting AppSideMonitor thread.\n")); + + int result = AppSideMonitor_Thread::instance ()->activate ();; + + if (result != 0) + { + CIAO_DEBUG ((LM_ERROR, + CLINFO "CIAO_ComponentServer_Task::CIAO_ComponentServer_Task - " + "AppSideMonitor_Thread::activate () returned %d\n", + result)); + } + this->configurator_->post_orb_initialize (this->orb_.in ()); this->parse_args (argc, argv); @@ -163,19 +176,6 @@ namespace CIAO poa_manager->activate (); CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - " - "starting AppSideMonitor thread.\n")); - - int result = AppSideMonitor_Thread::instance ()->activate ();; - - if (result != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "AppSideReg::activate () returned %d\n", - result), - -1); - } - - CIAO_DEBUG ((LM_TRACE, CLINFO "ComponentServer_Task::svc - " "Creating state synchronization servant\n")); // start up SSA |