summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp')
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp92
1 files changed, 48 insertions, 44 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
index 11b61543590..702ee6b48e0 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
@@ -3,11 +3,9 @@
#include "ImplRepo_i.h"
#include "Options.h"
-#include "tao/ORB.h"
-#include "tao/IIOP_Profile.h"
-#include "tao/IIOP_Acceptor.h"
#include "ace/Read_Buffer.h"
#include "ace/Process.h"
+#include "tao/IIOP_Profile.h"
// Constructor
@@ -25,7 +23,7 @@ CORBA::Object_ptr
ImplRepo_i::activate_object (CORBA::Object_ptr obj,
CORBA::Environment &ACE_TRY_ENV)
{
- /* Implementation_Repository::INET_Addr *new_addr; */
+ Implementation_Repository::INET_Addr *new_addr;
TAO_Stub *new_stub_obj = 0;
if (OPTIONS::instance()->debug () >= 1)
@@ -36,7 +34,7 @@ ImplRepo_i::activate_object (CORBA::Object_ptr obj,
ACE_TRY
{
// @@ Where to get the poa name from?
- /* new_addr = */ this->activate_server (0, ACE_TRY_ENV);
+ new_addr = this->activate_server (0, ACE_TRY_ENV);
ACE_TRY_CHECK;
// @@ Use auto_ptr<> to avoid memory leaks!
@@ -45,7 +43,11 @@ ImplRepo_i::activate_object (CORBA::Object_ptr obj,
ACE_dynamic_cast (TAO_IIOP_Profile *,
stub_obj->profile_in_use ());
- TAO_MProfile mp(1);
+ TAO_MProfile *mp;
+ ACE_NEW_THROW_EX (mp,
+ TAO_MProfile (1),
+ CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
TAO_Profile *new_pfile;
// @@ Would new_addr->host_ be different from object_addr()?
@@ -54,8 +56,8 @@ ImplRepo_i::activate_object (CORBA::Object_ptr obj,
TAO_IIOP_Profile (iiop_pfile->object_addr (),
iiop_pfile->object_key ()),
CORBA::Object::_nil ());
-
- mp.give_profile (new_pfile);
+
+ mp->give_profile (new_pfile);
// create new obj, pfile will be copied!
new_stub_obj = new TAO_Stub (stub_obj->type_id,
@@ -348,7 +350,7 @@ ImplRepo_i::server_is_running (const char *server,
ACE_NEW_RETURN (rec.host, ASYS_TCHAR[ACE_OS::strlen (addr.host_.in ()) + 1], 0);
ACE_OS::strcpy (rec.host, addr.host_.in ());
rec.port = addr.port_;
-
+
ASYS_TCHAR *ping_ior = this->orb_manager_.orb ()->object_to_string (ping, ACE_TRY_ENV);
ACE_CHECK_RETURN (0);
@@ -376,29 +378,7 @@ ImplRepo_i::server_is_running (const char *server,
rec.host,
rec.port));
- // @@ Don't use the ORB_Core_instance() keep a pointer to the ORB
- // and use the orb_core() accessor
- TAO_Acceptor_Registry* registry =
- this->orb_manager_.orb ()->orb_core ()->acceptor_registry ();
-
- TAO_Acceptor *acceptor = 0;
- TAO_AcceptorSetItor end = registry->end ();
- for (TAO_AcceptorSetItor i = registry->begin (); i != end; ++i)
- {
- if ((*i)->tag () == TAO_IOP_TAG_INTERNET_IOP)
- {
- acceptor = (*i);
- break;
- }
- }
- if (acceptor == 0)
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT(), 0);
-
- TAO_IIOP_Acceptor* iiop_acceptor =
- ACE_dynamic_cast (TAO_IIOP_Acceptor*,acceptor);
-
- // Get our host and port and convert it to something we can use.
- const ACE_INET_Addr& my_addr = iiop_acceptor->address ();
+ ACE_INET_Addr my_addr = TAO_ORB_Core_instance ()->orb_params ()->addr ();
// @@ We are assuming that we are on the same machine right now
new_addr->host_ = CORBA::string_dup (my_addr.get_host_name ());
@@ -681,32 +661,51 @@ void
IR_Forwarder::invoke (CORBA::ServerRequest_ptr /* request */,
CORBA::Environment &ACE_TRY_ENV)
{
- TAO_ORB_Core *orb_core = this->orb_var_->orb_core ();
- TAO_POA_Current_Impl *poa_current_impl = orb_core->poa_current ().implementation ();
+ // Get the POA Current object reference
+ CORBA::Object_var obj = this->orb_var_->resolve_initial_references ("POACurrent");
+
+ TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();
+ TAO_POA_Current *poa_current = orb_core->poa_current ();
+
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("PortableServer::Current::_narrow");
+ return;
+ }
// The servant determines the key associated with the database entry
// represented by self
- PortableServer::ObjectId_var oid = poa_current_impl->get_object_id (ACE_TRY_ENV);
- ACE_CHECK;
+ PortableServer::ObjectId_var oid = poa_current->get_object_id (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0)
+ return;
// Now convert the id into a string
CORBA::String_var key = PortableServer::ObjectId_to_string (oid.in ());
- PortableServer::POA_ptr poa = poa_current_impl->get_POA (ACE_TRY_ENV);
- ACE_CHECK;
+ PortableServer::POA_ptr poa = poa_current->get_POA (ACE_TRY_ENV);
+ if (ACE_TRY_ENV.exception () != 0)
+ return;
// Now FORWARD!!!
Implementation_Repository::INET_Addr *new_addr = 0;
- new_addr = this->ir_impl_->activate_server (poa->the_name (),
- ACE_TRY_ENV);
- ACE_CHECK;
+
+ ACE_TRY
+ {
+ new_addr = this->ir_impl_->activate_server (poa->the_name (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
CORBA_Object_ptr forward_object =
- this->orb_var_->key_to_object (poa_current_impl->object_key (),
+ this->orb_var_->key_to_object (poa_current->object_key (),
0,
ACE_TRY_ENV);
- ACE_CHECK;
TAO_Stub *stub_obj = ACE_dynamic_cast (TAO_Stub *,
forward_object->_stubobj ());
@@ -718,8 +717,13 @@ IR_Forwarder::invoke (CORBA::ServerRequest_ptr /* request */,
iiop_pfile->port (new_addr->port_);
iiop_pfile->host (new_addr->host_);
+// if (TAO_debug_level > 0)
+// ACE_DEBUG ((LM_DEBUG,
+// "The forward_to is <%s>\n",
+// this->orb_var_->object_to_string (forward_object, ACE_TRY_ENV)));
+
if (!CORBA::is_nil (forward_object))
- ACE_THROW (PortableServer::ForwardRequest (forward_object));
+ ACE_TRY_ENV.exception (new PortableServer::ForwardRequest (forward_object));
else
ACE_ERROR ((LM_ERROR,
"Error: Forward_to reference is nil.\n"));