diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-11-01 13:19:12 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-11-01 13:19:12 +0000 |
commit | 323815eec6085798f28a7f84d7cabc516d9ac969 (patch) | |
tree | 1714bd8d010d889770d0b0bc82ff6c2e2d4e0ea0 | |
parent | b6c796cec03b53f47273e4765fa511fb6483256d (diff) | |
download | ATCD-323815eec6085798f28a7f84d7cabc516d9ac969.tar.gz |
Tue Nov 1 13:18:21 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu>
* dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp:
* dance/Plan_Launcher/Plan_Launcher_Base.h:
* dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h:
* dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp:
Removed create_external_connections and moved functionality into the
LocalityManager. Thanks to Martin Corino <mcorino@remedy.nl> for the
fixes.
-rw-r--r-- | DAnCE/ChangeLog | 11 | ||||
-rw-r--r-- | DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp | 94 | ||||
-rw-r--r-- | DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h | 4 | ||||
-rw-r--r-- | DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp | 60 | ||||
-rw-r--r-- | DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h | 3 |
5 files changed, 66 insertions, 106 deletions
diff --git a/DAnCE/ChangeLog b/DAnCE/ChangeLog index 8edbe95f424..0725b36ccfe 100644 --- a/DAnCE/ChangeLog +++ b/DAnCE/ChangeLog @@ -1,3 +1,14 @@ +Tue Nov 1 13:18:21 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> + + * dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp: + * dance/Plan_Launcher/Plan_Launcher_Base.h: + * dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h: + * dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp: + + Removed create_external_connections and moved functionality into the + LocalityManager. Thanks to Martin Corino <mcorino@remedy.nl> for the + fixes. + Sun Oct 30 22:42:44 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> * bin/ciao.localityconfig: diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp index 851253e5d90..0ef843479c3 100644 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp +++ b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp @@ -17,6 +17,7 @@ #include "dance/LocalityManager/Scheduler/Events/Remove.h" #include "dance/LocalityManager/Scheduler/Events/Passivate.h" #include "dance/LocalityManager/Scheduler/Events/Disconnect.h" +#include "ace/Auto_Ptr.h" namespace DAnCE { @@ -310,41 +311,62 @@ namespace DAnCE CORBA::ULong dispatched (0); Deployment_Completion completion (this->scheduler_); + ::Deployment::Connections *conn_cmp = 0; + ACE_NEW_THROW_EX (conn_cmp, + ::Deployment::Connections (this->plan_.connection.length ()), + CORBA::NO_MEMORY ()); + ACE_Auto_Ptr< ::Deployment::Connections > conn_safe (conn_cmp); + CORBA::ULong conn_pos (0); + for (CORBA::ULong i = 0; i < this->plan_.connection.length (); ++i) { const ::Deployment::PlanConnectionDescription &conn = this->plan_.connection[i]; - for (CORBA::ULong j = 0; - j != conn.internalEndpoint.length (); - ++j) + + if (conn.externalReference.length () > 0) { - if (conn.internalEndpoint[j].provider) - { - CORBA::ULong instRef = - conn.internalEndpoint[j].instanceRef; - CORBA::ULong implRef = - this->plan_.instance[instRef].implementationRef; - - const char *inst_type = - Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); - - Endpoint_Reference *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Endpoint_Reference (this->plan_, - i, - inst_type, - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } + // connections with external reference endpoints + // we do not know how to resolve here; we just + // collect them and allow connect handlers/interceptors + // to handle them later + conn_cmp->length (conn_pos + 1); + (*conn_cmp)[conn_pos].name = conn.name.in (); + (*conn_cmp)[conn_pos].endpoint.length (1); + (*conn_cmp)[conn_pos].endpoint[0] = CORBA::Object::_nil (); + ++conn_pos; } + else + for (CORBA::ULong j = 0; + j != conn.internalEndpoint.length (); + ++j) + { + if (conn.internalEndpoint[j].provider) + { + CORBA::ULong instRef = + conn.internalEndpoint[j].instanceRef; + CORBA::ULong implRef = + this->plan_.instance[instRef].implementationRef; + + const char *inst_type = + Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); + + Endpoint_Reference *event (0); + Event_Future result; + completion.accept (result); + + ACE_NEW_THROW_EX (event, + Endpoint_Reference (this->plan_, + i, + inst_type, + result), + CORBA::NO_MEMORY ()); + + this->scheduler_.schedule_event (event); + ++dispatched; + } + } } ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); @@ -372,12 +394,6 @@ namespace DAnCE completed_events.size ())); } - ::Deployment::Connections *conn_cmp = 0; - ACE_NEW_THROW_EX (conn_cmp, - ::Deployment::Connections (this->plan_.connection.length ()), - CORBA::NO_MEMORY ()); - - CORBA::ULong pos (0); for (Event_List::iterator i = completed_events.begin (); i != completed_events.end (); ++i) @@ -419,14 +435,14 @@ namespace DAnCE event.id_.c_str ())); } - conn_cmp->length (pos + 1); - (*conn_cmp)[pos].name = event.id_.c_str (); - (*conn_cmp)[pos].endpoint.length (1); - (*conn_cmp)[pos].endpoint[0] = obj_ref; - ++pos; + conn_cmp->length (conn_pos + 1); + (*conn_cmp)[conn_pos].name = event.id_.c_str (); + (*conn_cmp)[conn_pos].endpoint.length (1); + (*conn_cmp)[conn_pos].endpoint[0] = obj_ref; + ++conn_pos; } - providedReference = conn_cmp; + providedReference = conn_safe.release (); } void diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h index dd5204b33cd..a06cc62433c 100644 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h +++ b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h @@ -51,10 +51,6 @@ namespace DAnCE /// Instructs the Manager to destroy the ApplicationManager. virtual void destroy_app_manager (CORBA::Object_ptr app_mgr) = 0; - - /// Helper method to resolve externalReference endpoints into valid object references. - virtual void create_external_connections(const ::Deployment::DeploymentPlan &plan, - Deployment::Connections &conn) = 0; }; } diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp index 6ec8a70e0cf..8e24e856421 100644 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp +++ b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp @@ -453,8 +453,6 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application> { DANCE_TRACE ("Plan_Launcher_Base_Impl::launch_plan"); - //this->create_external_connections (plan, conns.inout()); - try { CORBA::Object_var app_mgr = this->prepare_plan (plan); @@ -465,9 +463,6 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application> 0, conns.out ()); - this->create_external_connections (plan, - conns.inout ()); - this->finish_launch (app.in (), conns, false); @@ -640,60 +635,5 @@ Plan_Launcher_Base_Impl< Manager, AppManager, Application>::destroy_app_manager( } } - -template <typename Manager, typename AppManager, typename Application> -void -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::create_external_connections(const ::Deployment::DeploymentPlan &plan, - Deployment::Connections &conn) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("create_external_connections - start\n"))); - - for (CORBA::ULong i = 0; i < plan.connection.length(); i++) - { - if (plan.connection[i].externalReference.length() > 0) - //&& plan.connection[i].externalReference[0].provider) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher_i::create_external_connections - ") - ACE_TEXT ("create connection %C from IOR %C\n"), - plan.connection[i].name.in(), - plan.connection[i].externalReference[0].location.in())); - - try - { - CORBA::ULong indx = 0; - for (; indx < conn.length (); ++indx) - if (ACE_OS::strcmp (conn[indx].name.in (), - plan.connection[i].name.in ()) == 0) - break; - - if (indx == conn.length()) - conn.length(indx + 1); - conn[indx].name= CORBA::string_dup (plan.connection[i].name.in()); - conn[indx].endpoint.length (1); - } - catch (CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_i::create_external_connections - ") - ACE_TEXT("Caught CORBA Exception while resolving endpoint for connection %C: %C\n"), - plan.connection[i].name.in (), - ex._info ().c_str ())); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_i::create_external_connections - ") - ACE_TEXT("Caught C++ Exception while resolving endpoint for connection\n"))); - } - } - } -} } #endif diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h index 9e69b5b6299..a5b412e8550 100644 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h +++ b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h @@ -69,9 +69,6 @@ namespace DAnCE virtual void destroy_app_manager (CORBA::Object_ptr); - virtual void create_external_connections(const ::Deployment::DeploymentPlan &plan, - Deployment::Connections &conn); - protected: /// Cached ORB pointer CORBA::ORB_var orb_; |