summaryrefslogtreecommitdiff
path: root/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp')
-rw-r--r--DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp94
1 files changed, 55 insertions, 39 deletions
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