summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-11-03 03:37:54 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-11-03 03:37:54 +0000
commit0a387376acd34fb6c0bfcd0865bc7abe6008863b (patch)
tree5efcb7a977d5a26b03fe8c65f945c665c489a624
parentae098feac9d8ac72d48414b592403f8d899667e5 (diff)
downloadATCD-0a387376acd34fb6c0bfcd0865bc7abe6008863b.tar.gz
ChangeLogTag:Tue Nov 2 21:19:42 1999 Darrell Brunsch <brunsch@cs.wustl.edu>
-rw-r--r--TAO/docs/Options.html6
-rw-r--r--TAO/docs/implrepo/index.html4
-rw-r--r--TAO/docs/implrepo/usersguide.html4
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp96
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h7
-rw-r--r--TAO/orbsvcs/orbsvcs/IOR_Multicast.cpp5
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp117
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/airplane_server_i.h12
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp135
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h12
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/run_test.pl17
-rw-r--r--TAO/tao/ORB.cpp76
-rw-r--r--TAO/tao/ORB.h3
-rw-r--r--TAO/tao/ORB_Core.cpp13
-rw-r--r--TAO/tao/params.cpp3
-rw-r--r--TAO/tao/params.h8
-rw-r--r--TAO/tao/params.i11
17 files changed, 400 insertions, 129 deletions
diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html
index 657d0963575..270fb6d9a38 100644
--- a/TAO/docs/Options.html
+++ b/TAO/docs/Options.html
@@ -383,6 +383,12 @@ merged with <a href="#-ORBCollocation"><code>-ORBCollocation</code></a>.
Currently the resources are limited to the reactor.
</TD>
</TR>
+ <TR>
+ <TD><CODE>-ORBMulticast</CODE> <EM>boolean (0|1)</EM></TD>
+ <TD><A NAME="-ORBMulticast"></a>Enable or disable Multicast use in
+ resolve_initial_reference (). By default, Multicast is enabled on
+ platforms that support it.</TD>
+ </TR>
</TABLE>
</P>
diff --git a/TAO/docs/implrepo/index.html b/TAO/docs/implrepo/index.html
index 591974326c2..f127b10fae3 100644
--- a/TAO/docs/implrepo/index.html
+++ b/TAO/docs/implrepo/index.html
@@ -78,10 +78,6 @@ are not finished or complete yet.</p>
<td>Only some options have been added, but the general work is still in prograss.</td>
</tr>
<tr>
- <td>Multicast location of IRs</td>
- <td>The client part is in the ORB, but the server doesn't listen for it yet.</td>
- </tr>
- <tr>
<td>Client-side Optimizations</td>
<td>Nothing planned yet</td>
</tr>
diff --git a/TAO/docs/implrepo/usersguide.html b/TAO/docs/implrepo/usersguide.html
index f5178ecc1d2..d68f3db10c1 100644
--- a/TAO/docs/implrepo/usersguide.html
+++ b/TAO/docs/implrepo/usersguide.html
@@ -76,8 +76,8 @@ hiding much of the work of registration in methods. </p>
ACE_DEBUG.<br>
<br>
The constructor creates a ServerObject and registers it with the Implementation
- Repository. It receives a reference to the IR via the ORB, so the ORB must be passed
- the information via the command line (since multicast is not fully operational yet)..
+ Repository. It receives a reference to the IR via the ORB, so the ORB can be passed
+ the information via the command line or it can find it via multicast.
<code><br>
</code></li>
<li><code>void notify_startup ();<br>
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
index 1ba3eb714cb..75256fb608f 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
@@ -15,7 +15,8 @@
ImplRepo_i::ImplRepo_i (void)
: forwarder_impl_ (0),
- activator_ (0)
+ activator_ (0),
+ ior_multicast_ (0)
{
// Nothing
}
@@ -224,6 +225,7 @@ ImplRepo_i::register_server (const char *server,
}
}
+
// Updates the entry in the Repository about this <server> or adds it
// if necessary.
@@ -235,13 +237,22 @@ ImplRepo_i::reregister_server (const char *server,
{
ACE_UNUSED_ARG (ACE_TRY_ENV);
+ // Get current starting up value
+ int starting_up = this->repository_.starting_up (server);
+
+ // Remove old info
this->repository_.remove (server);
+ // Add server with new startup parameters
this->repository_.add (server,
"",
options.command_line.in (),
options.working_directory.in ());
+ // Set old starting up value, if there was one.
+ if (starting_up != -1)
+ this->repository_.starting_up (server, starting_up);
+
if (OPTIONS::instance()->debug () >= 1)
ACE_DEBUG ((LM_DEBUG,
"Server %s Successfully Registered\n",
@@ -255,6 +266,7 @@ ImplRepo_i::reregister_server (const char *server,
options.working_directory.in ()));
}
+
// Remove the server entry from the Repository
void
@@ -419,22 +431,22 @@ ImplRepo_i::init (int argc, char **argv, CORBA::Environment &ACE_TRY_ENV)
"The server IOR is: <%s>\n",
str.in ()));
- CORBA::String_var ir_var =
+ this->ir_var_ =
this->orb_manager_.activate_under_child_poa ("implrepo",
this,
ACE_TRY_ENV);
ACE_TRY_CHECK;
- if (OPTIONS::instance()->debug () >= 2)
+ if (OPTIONS::instance ()->debug () >= 2)
ACE_DEBUG ((LM_DEBUG,
"The IR IOR is: <%s>\n",
- ir_var.in ()));
+ this->ir_var_.in ()));
if (OPTIONS::instance()->output_file ())
{
ACE_OS::fprintf (OPTIONS::instance()->output_file (),
"%s",
- ir_var.in ());
+ this->ir_var_.in ());
ACE_OS::fclose (OPTIONS::instance()->output_file ());
}
@@ -457,6 +469,77 @@ ImplRepo_i::init (int argc, char **argv, CORBA::Environment &ACE_TRY_ENV)
root_poa->the_activator (activator.in (),
ACE_TRY_ENV);
ACE_TRY_CHECK;
+
+#if defined (ACE_HAS_IP_MULTICAST)
+ //
+ // Install ior multicast handler.
+ //
+ // Get reactor instance from TAO.
+ ACE_Reactor *reactor =
+ TAO_ORB_Core_instance ()->reactor ();
+
+ // See if the -ORBMulticastDiscoveryEndpoint option was specified.
+ ACE_CString mde (TAO_ORB_Core_instance ()->orb_params ()
+ ->mcast_discovery_endpoint ());
+
+ // First, see if the user has given us a multicast port number
+ // on the command-line;
+ u_short port =
+ TAO_ORB_Core_instance ()->orb_params ()->service_port (IMPLREPOSERVICE);
+
+ if (port == 0)
+ {
+ // Check environment var. for multicast port.
+ const char *port_number =
+ ACE_OS::getenv ("ImplRepoServicePort");
+
+ if (port_number != 0)
+ port = ACE_OS::atoi (port_number);
+ }
+
+ // Port wasn't specified on the command-line or in environment -
+ // use the default.
+ if (port == 0)
+ port = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT;
+
+ // Instantiate a handler which will handle client requests for
+ // the root Naming Context ior, received on the multicast port.
+ ACE_NEW_RETURN (this->ior_multicast_,
+ TAO_IOR_Multicast (),
+ -1);
+
+ if (mde.length () != 0)
+ {
+ if (this->ior_multicast_->init (this->ir_var_.in (),
+ mde.c_str (),
+ TAO_SERVICEID_IMPLREPOSERVICE) == -1)
+ return -1;
+ }
+ else
+ {
+ if (this->ior_multicast_->init (this->ir_var_.in (),
+ port,
+ ACE_DEFAULT_MULTICAST_ADDR,
+ TAO_SERVICEID_IMPLREPOSERVICE) == -1)
+ return -1;
+ }
+
+ // Register event handler for the ior multicast.
+ if (reactor->register_handler (this->ior_multicast_,
+ ACE_Event_Handler::READ_MASK) == -1)
+ {
+ if (OPTIONS::instance ()->debug () > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Implementation Repository: cannot register Event handler\n"));
+ return -1;
+ }
+
+ if (OPTIONS::instance ()->debug () > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Implementation Repository: The multicast server setup is done.\n"));
+
+#endif /* ACE_HAS_IP_MULTICAST */
+
}
ACE_CATCHANY
{
@@ -510,6 +593,9 @@ ImplRepo_i::~ImplRepo_i (void)
if (this->activator_ != 0)
delete this->activator_;
+
+ if (this->ior_multicast_ != 0)
+ delete this->ior_multicast_;
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
index 1c40118765d..264e59cf0d4 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
@@ -21,6 +21,7 @@
#define IMPLREPO_I_H
#include "orbsvcs/ImplRepoS.h"
+#include "orbsvcs/IOR_Multicast.h"
#include "Repository.h"
#include "tao/TAO.h"
@@ -174,6 +175,12 @@ private:
char *server_input_file_;
// Copy of the filename for the server output file.
+ TAO_IOR_Multicast *ior_multicast_;
+ // The ior_multicast event handler.
+
+ CORBA::String_var ir_var_;
+ // The IR's IOR
+
int argc_;
// Number of command line arguments.
diff --git a/TAO/orbsvcs/orbsvcs/IOR_Multicast.cpp b/TAO/orbsvcs/orbsvcs/IOR_Multicast.cpp
index f25fbf9a781..e3d8ff178e9 100644
--- a/TAO/orbsvcs/orbsvcs/IOR_Multicast.cpp
+++ b/TAO/orbsvcs/orbsvcs/IOR_Multicast.cpp
@@ -168,7 +168,10 @@ TAO_IOR_Multicast::handle_input (ACE_HANDLE)
if (ACE_OS::strcmp (service_name,
"NameService") != 0
&& ACE_OS::strcmp (service_name,
- "TradingService") != 0)
+ "TradingService") != 0
+ && ACE_OS::strcmp (service_name,
+ "ImplRepoService") != 0
+ )
{
// The client has requested an IOR other than for the
// Name/Trading Service. Lookup the table for the IOR. The call
diff --git a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
index 07ba21dac57..22fced82a19 100644
--- a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
@@ -6,6 +6,9 @@
ACE_RCSID(ImplRepo, airplane_server_i, "$Id$")
+// The server name of the Aiprlane Server
+const char SERVER_NAME[] = "airplane_server";
+
Airplane_Server_i::Airplane_Server_i (void)
: server_impl_ (0),
ior_output_file_ (0),
@@ -56,65 +59,115 @@ Airplane_Server_i::parse_args (void)
int
Airplane_Server_i::init (int argc, char** argv, CORBA::Environment &ACE_TRY_ENV)
{
- char poa_name[] = "plane";
+ // Since the Implementation Repository keys off of the POA name, we need
+ // to use the SERVER_NAME as the POA's name.
+ const char *poa_name = SERVER_NAME;
ACE_TRY
{
- // Call the init of <TAO_ORB_Manager> to initialize the ORB and
- // create a child POA under the root POA.
- if (this->orb_manager_.init_child_poa (argc, argv, poa_name, ACE_TRY_ENV) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init_child_poa"), -1);
-
- ACE_TRY_CHECK;
-
- if (this->orb_manager_.activate_poa_manager (ACE_TRY_ENV) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "activate_poa_manager"), -1);
-
+ // Initialize the ORB
+ this->orb_ = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
+ // Save pointers to the command line arguments
this->argc_ = argc;
this->argv_ = argv;
+ // Now check the arguments for our options
int retval = this->parse_args ();
if (retval != 0)
return retval;
- ACE_NEW_RETURN (this->server_impl_, Airplane_i (this->use_ir_), -1);
+ // Get the POA from the ORB.
+ CORBA::Object_var poa_object =
+ this->orb_->resolve_initial_references ("RootPOA",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Check the POA object.
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Airplane_i::init(): Unable to initialize the POA.\n"),
+ -1);
- CORBA::String_var server_str =
- this->orb_manager_.activate_under_child_poa ("server",
- this->server_impl_,
- ACE_TRY_ENV);
+ // Narrow the object to a POA.
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
- PortableServer::POA_var child_poa = this->orb_manager_.child_poa ();
- CORBA::ORB_var orb = this->orb_manager_.orb ();
+ // Get the POA_Manager.
+ this->poa_manager_ = root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // We now need to create a POA with the persistent and user_id policies,
+ // since they are need for use with the Implementation Repository.
+
+ CORBA::PolicyList policies (2);
+ policies.length (2);
+
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK
+
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
- if (this->use_ir_ == 1)
- ACE_NEW_RETURN (this->ir_helper_, IR_Helper (poa_name,
- child_poa.in (),
- orb.in (),
- TAO_debug_level),
- -1);
+ this->airplane_poa_ =
+ root_poa->create_POA (poa_name,
+ this->poa_manager_.in (),
+ policies,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
- PortableServer::ObjectId_var id =
+ // Creation of the new POA is over, so destroy the Policy_ptr's.
+ for (CORBA::ULong i = 0; i < policies.length (); ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ policy->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ // Make sure the POA manager is activated.
+ this->poa_manager_->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_NEW_RETURN (this->server_impl_,
+ Airplane_i (this->use_ir_),
+ -1);
+
+ PortableServer::ObjectId_var server_id =
PortableServer::string_to_ObjectId ("server");
+ this->airplane_poa_->activate_object_with_id (server_id.in (),
+ this->server_impl_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
CORBA::Object_var server_obj =
- child_poa->id_to_reference (id.in (),
- ACE_TRY_ENV);
+ this->airplane_poa_->id_to_reference (server_id.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
+
if (this->use_ir_ == 1)
{
+ ACE_NEW_RETURN (this->ir_helper_, IR_Helper (SERVER_NAME,
+ this->airplane_poa_,
+ this->orb_,
+ TAO_debug_level),
+ -1);
this->ir_helper_->change_object (server_obj.inout (), ACE_TRY_ENV);
ACE_TRY_CHECK;
}
-
- server_str =
- orb->object_to_string (server_obj.in (),
- ACE_TRY_ENV);
+
+ // Create an IOR from the server object.
+ CORBA::String_var server_str =
+ this->orb_->object_to_string (server_obj.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
if (TAO_debug_level > 0)
@@ -149,7 +202,7 @@ Airplane_Server_i::run (CORBA::Environment &ACE_TRY_ENV)
ACE_TRY_CHECK;
}
- this->orb_manager_.run (ACE_TRY_ENV);
+ this->orb_->run (ACE_TRY_ENV);
ACE_TRY_CHECK;
if (this->use_ir_ == 1)
diff --git a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.h b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.h
index 6dbf961bf31..b1cf0f377ee 100644
--- a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.h
+++ b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.h
@@ -21,7 +21,7 @@
#if !defined (AIRPLANE_SERVER_I_H)
#define AIRPLANE_SERVER_I_H
-#include "tao/TAO.h"
+#include "tao/corba.h"
#include "airplane_i.h"
#include "orbsvcs/IR_Helper.h"
@@ -58,8 +58,14 @@ private:
char **argv_;
// The command line arguments.
- TAO_ORB_Manager orb_manager_;
- // The ORB manager.
+ CORBA::ORB_var orb_;
+ // The ORB.
+
+ PortableServer::POA_var airplane_poa_;
+ // The POA for the Airplane Server.
+
+ PortableServer::POAManager_var poa_manager_;
+ // The POA manager.
Airplane_i *server_impl_;
// The Paper Airplane Server Implementation.
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp
index 012cc47418f..084fbf1751a 100644
--- a/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp
@@ -6,7 +6,11 @@
ACE_RCSID(ImplRepo, nestea_server_i, "$Id$")
-const char *NESTEA_DATA_FILENAME = "nestea.dat";
+// The file to save the persistent state to.
+const char NESTEA_DATA_FILENAME[] = "nestea.dat";
+
+// The server name of the Nestea Server
+const char SERVER_NAME[] = "nestea_server";
Nestea_Server_i::Nestea_Server_i (const char * /*filename*/)
: server_impl_ (0),
@@ -62,66 +66,129 @@ Nestea_Server_i::parse_args (void)
return 0;
}
+
+// The init() method does quite a few things.
+//
+// - Initialize the ORB
+// - Create a persistent POA for the server
+// - Activate the POA Manager
+// - Activate the servant under the POA
+// - Uses the IR helper class to alter the object
+// - Creates an IOR from the servant and outputs it to a file
+
int
Nestea_Server_i::init (int argc, char** argv, CORBA::Environment &ACE_TRY_ENV)
{
- char poa_name[] = "nestea_server";
+ // Since the Implementation Repository keys off of the POA name, we need
+ // to use the SERVER_NAME as the POA's name.
+ const char *poa_name = SERVER_NAME;
ACE_TRY
{
- // Call the init of <TAO_ORB_Manager> to initialize the ORB and
- // create a child POA under the root POA.
- if (this->orb_manager_.init_child_poa (argc, argv, poa_name, ACE_TRY_ENV) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init_child_poa"), -1);
-
- ACE_TRY_CHECK;
-
- if (this->orb_manager_.activate_poa_manager (ACE_TRY_ENV) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "activate_poa_manager"), -1);
-
+ // Initialize the ORB
+ this->orb_ = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
+ // Save pointers to the command line arguments
this->argc_ = argc;
this->argv_ = argv;
+ // Now check the arguments for our options
int retval = this->parse_args ();
if (retval != 0)
return retval;
- ACE_NEW_RETURN (this->server_impl_, Nestea_i (NESTEA_DATA_FILENAME, this->use_ir_), -1);
+ // Get the POA from the ORB.
+ CORBA::Object_var poa_object =
+ this->orb_->resolve_initial_references ("RootPOA",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Check the POA object.
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Nestea_i::init(): Unable to initialize the POA.\n"),
+ -1);
- CORBA::String_var server_str =
- this->orb_manager_.activate_under_child_poa ("server",
- this->server_impl_,
- ACE_TRY_ENV);
+ // Narrow the object to a POA.
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
- if (this->use_ir_ == 1)
- ACE_NEW_RETURN (this->ir_helper_, IR_Helper (poa_name,
- this->orb_manager_.child_poa (),
- this->orb_manager_.orb (),
- TAO_debug_level),
- -1);
+ // Get the POA_Manager.
+ this->poa_manager_ = root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // We now need to create a POA with the persistent and user_id policies,
+ // since they are need for use with the Implementation Repository.
+
+ CORBA::PolicyList policies (2);
+ policies.length (2);
+
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK
+
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ this->nestea_poa_ =
+ root_poa->create_POA (poa_name,
+ this->poa_manager_.in (),
+ policies,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Creation of the new POA is over, so destroy the Policy_ptr's.
+ for (CORBA::ULong i = 0; i < policies.length (); ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ policy->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ // Make sure the POA manager is activated.
+ this->poa_manager_->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
- PortableServer::ObjectId_var id =
+ ACE_NEW_RETURN (this->server_impl_,
+ Nestea_i (NESTEA_DATA_FILENAME,
+ this->use_ir_),
+ -1);
+
+ PortableServer::ObjectId_var server_id =
PortableServer::string_to_ObjectId ("server");
+ this->nestea_poa_->activate_object_with_id (server_id.in (),
+ this->server_impl_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
CORBA::Object_var server_obj =
- this->orb_manager_.child_poa ()->id_to_reference (id.in (),
- ACE_TRY_ENV);
+ this->nestea_poa_->id_to_reference (server_id.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
+
if (this->use_ir_ == 1)
{
+ ACE_NEW_RETURN (this->ir_helper_, IR_Helper (SERVER_NAME,
+ this->nestea_poa_,
+ this->orb_,
+ TAO_debug_level),
+ -1);
this->ir_helper_->change_object (server_obj.inout (), ACE_TRY_ENV);
ACE_TRY_CHECK;
}
-
- server_str =
- this->orb_manager_.orb ()->object_to_string (server_obj.in (),
- ACE_TRY_ENV);
+
+ // Create an IOR from the server object.
+ CORBA::String_var server_str =
+ this->orb_->object_to_string (server_obj.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
if (TAO_debug_level > 0)
@@ -148,6 +215,8 @@ Nestea_Server_i::init (int argc, char** argv, CORBA::Environment &ACE_TRY_ENV)
int
Nestea_Server_i::run (CORBA::Environment &ACE_TRY_ENV)
{
+ int status = 0;
+
ACE_TRY
{
if (this->use_ir_ == 1)
@@ -156,7 +225,7 @@ Nestea_Server_i::run (CORBA::Environment &ACE_TRY_ENV)
ACE_TRY_CHECK;
}
- this->orb_manager_.run (ACE_TRY_ENV);
+ status = this->orb_->run (ACE_TRY_ENV);
ACE_TRY_CHECK;
if (this->use_ir_ == 1)
@@ -174,5 +243,5 @@ Nestea_Server_i::run (CORBA::Environment &ACE_TRY_ENV)
ACE_CHECK_RETURN (-1);
- return 0;
+ return status;
}
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h
index 04c2c4a7dcd..69a2d5ceb55 100644
--- a/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h
@@ -21,7 +21,7 @@
#if !defined (NESTEA_SERVER_I_H)
#define NESTEA_SERVER_I_H
-#include "tao/TAO.h"
+#include "tao/corba.h"
#include "nestea_i.h"
#include "orbsvcs/IR_Helper.h"
@@ -58,9 +58,15 @@ private:
char **argv_;
// The command line arguments.
- TAO_ORB_Manager orb_manager_;
- // The ORB manager.
+ CORBA::ORB_var orb_;
+ // The ORB.
+ PortableServer::POA_var nestea_poa_;
+ // The POA for the Nestea Server.
+
+ PortableServer::POAManager_var poa_manager_;
+ // The POA manager.
+
Nestea_i *server_impl_;
// The Nestea Bookshelf Server Implementation.
diff --git a/TAO/orbsvcs/tests/ImplRepo/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/run_test.pl
index fd82f30223e..0aab95bcc78 100755
--- a/TAO/orbsvcs/tests/ImplRepo/run_test.pl
+++ b/TAO/orbsvcs/tests/ImplRepo/run_test.pl
@@ -49,7 +49,7 @@ sub airplane_ir_test
ACE::waitforfile ($implrepo_ior);
- system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add plane -c \"$airplane_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
+ system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"$airplane_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
$SV = Process::Create ($airplane_server,
"-o $airplane_ior -i -ORBObjRefStyle URL -ORBInitRef ImplRepoService=file://$implrepo_ior");
@@ -58,11 +58,11 @@ sub airplane_ir_test
system($airplane_client." -k file://$airplane_ior");
- system($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown plane");
+ system($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
system($airplane_client." -k file://$airplane_ior");
- system($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown plane");
+ system($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
$IR->Kill (); $IR->Wait ();
}
@@ -112,8 +112,8 @@ sub both_ir_test
ACE::waitforfile ($implrepo_ior);
- system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add plane -c \"$airplane_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
- system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add nestea -c \"$nestea_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
+ system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"$airplane_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
+ system ($tao_ir." -ORBInitRef ImplRepoService=file://$implrepo_ior add nestea_server -c \"$nestea_server -i -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
$ASV = Process::Create ($nestea_server,
"-o $nestea_ior -i -ORBObjRefStyle URL -ORBInitRef ImplRepoService=file://$implrepo_ior");
@@ -123,14 +123,15 @@ sub both_ir_test
ACE::waitforfile ($nestea_ior);
$NCL = Process::Create ($nestea_client, "-k file://$nestea_ior");
+ $ACL = Process::Create ($airplane_client, "-k file://$airplane_ior");
- ACE::waitforfile ($airplane_ior);
-
- system($airplane_client." -k file://$airplane_ior");
+ $ncl_status = $NCL->TimedWait (300);
+ $acl_status = $ACL->TimedWait (300);
$ASV->Kill (); $ASV->Wait ();
$NSV->Kill (); $NSV->Wait ();
$NCL->Kill (); $NCL->Wait ();
+ $ACL->Kill (); $ACL->Wait ();
$IR->Kill (); $IR->Wait ();
}
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index a2b61b9bdf8..2cb55e07052 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -467,64 +467,68 @@ CORBA_ORB::resolve_service (MCAST_SERVICEID mcast_service_id,
"ImplRepoServicePort"
};
- u_short default_service_port [] =
- {
- TAO_DEFAULT_NAME_SERVER_REQUEST_PORT,
- TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT,
- TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT
- };
-
- const char * service_objid [] =
- {
- TAO_OBJID_NAMESERVICE,
- TAO_OBJID_TRADINGSERVICE,
- TAO_OBJID_IMPLREPOSERVICE
- };
-
- CORBA_Object_var return_value = CORBA_Object::_nil ();
-
- // By now, the table filled in with -ORBInitRef arguments has been
- // checked. We only get here if the table didn't contain an initial
- // reference for the requested Service.
-
- // Check to see if the user has an environment variable.
- ACE_CString service_ior = ACE_OS::getenv (env_service_ior[mcast_service_id]);
+ u_short default_service_port [] =
+ {
+ TAO_DEFAULT_NAME_SERVER_REQUEST_PORT,
+ TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT,
+ TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT
+ };
- if (service_ior.length () != 0)
+ const char * service_objid [] =
+ {
+ TAO_OBJID_NAMESERVICE,
+ TAO_OBJID_TRADINGSERVICE,
+ TAO_OBJID_IMPLREPOSERVICE
+ };
+
+ CORBA_Object_var return_value = CORBA_Object::_nil ();
+
+ // By now, the table filled in with -ORBInitRef arguments has been
+ // checked. We only get here if the table didn't contain an initial
+ // reference for the requested Service.
+
+ // Check to see if the user has an environment variable.
+ ACE_CString service_ior = ACE_OS::getenv (env_service_ior[mcast_service_id]);
+
+ if (service_ior.length () != 0)
{
return_value =
this->string_to_object (service_ior.c_str (),
ACE_TRY_ENV);
ACE_CHECK_RETURN (CORBA_Object::_nil ());
}
- else
+ else
{
// First, determine if the port was supplied on the command line
u_short port =
this->orb_core_->orb_params ()->service_port (mcast_service_id);
-
+
if (port == 0)
{
// Look for the port among our environment variables.
const char *port_number =
ACE_OS::getenv (env_service_port[mcast_service_id]);
-
+
if (port_number != 0)
port = (u_short) ACE_OS::atoi (port_number);
else
port = default_service_port[mcast_service_id];
}
-
- return_value =
- this->multicast_to_service (service_objid[mcast_service_id],
- port,
- timeout,
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (CORBA_Object::_nil ());
+
+ // Find service with multicast.
+ if (this->orb_core_->orb_params ()->use_multicast ())
+ {
+ return_value =
+ this->multicast_to_service (service_objid[mcast_service_id],
+ port,
+ timeout,
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (CORBA_Object::_nil ());
+ }
}
-
- // Return ior.
- return return_value._retn ();
+
+ // Return ior.
+ return return_value._retn ();
}
int
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index db4b303a52a..0bf9defcc49 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -45,7 +45,8 @@
typedef enum
{
TAO_SERVICEID_NAMESERVICE,
- TAO_SERVICEID_TRADINGSERVICE
+ TAO_SERVICEID_TRADINGSERVICE,
+ TAO_SERVICEID_IMPLREPOSERVICE
} TAO_Service_ID;
// = Forward declarations.
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index f8b5dae89ef..061c0ca6964 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -256,6 +256,9 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV)
// Use TCP_NODELAY.
size_t nodelay = 1;
+ // Use Multicast
+ size_t multicast = 1;
+
// Should we skip the <ACE_Service_Config::open> method, e.g., if we
// already being configured by the ACE Service Configurator.
int skip_service_config_open = 0;
@@ -883,6 +886,15 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV)
ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
}
+ else if ((current_arg = arg_shifter.get_the_parameter
+ ("-ORBMulticast")))
+ {
+ // Use Multicast or not.
+ multicast =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
////////////////////////////////////////////////////////////////
// catch all the remaining -ORB args //
@@ -1084,6 +1096,7 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV)
this->orb_params ()->use_lite_protocol (giop_lite);
this->orb_params ()->std_profile_components (std_profile_components);
+ this->orb_params ()->use_multicast (multicast);
// Set up the pluggable protocol infrastructure. First get a
// pointer to the protocol factories set, then obtain pointers to
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
index 26cf6d0d3fa..359fa6f70f1 100644
--- a/TAO/tao/params.cpp
+++ b/TAO/tao/params.cpp
@@ -22,7 +22,8 @@ TAO_ORB_Parameters::TAO_ORB_Parameters (void)
cdr_memcpy_tradeoff_ (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF),
use_lite_protocol_ (0),
use_dotted_decimal_addresses_ (0),
- std_profile_components_ (1)
+ std_profile_components_ (1),
+ use_multicast_ (1)
{
for (int i=0; i<= NO_OF_MCAST_SERVICES; i++)
this->service_port_[i] = 0;
diff --git a/TAO/tao/params.h b/TAO/tao/params.h
index 02b67e32e83..e47b42e6dd9 100644
--- a/TAO/tao/params.h
+++ b/TAO/tao/params.h
@@ -175,6 +175,11 @@ public:
// Disable the OMG standard profile components, useful for
// homogenous environments.
+ int use_multicast (void) const;
+ void use_multicast (int um);
+ // Set/Get the flag for whether multicast should be used in
+ // resolve_initial_references ().
+
private:
// Each "endpoint" is of the form:
//
@@ -248,6 +253,9 @@ private:
int std_profile_components_;
// If true then the standard OMG components are not generated.
+
+ int use_multicast_;
+ // 1 if we want to use multicast, 0 if we want to suppress it.
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/params.i b/TAO/tao/params.i
index 795cb20b4bd..5e592bce09f 100644
--- a/TAO/tao/params.i
+++ b/TAO/tao/params.i
@@ -171,3 +171,14 @@ TAO_ORB_Parameters::nodelay (int x)
this->nodelay_ = x;
}
+ACE_INLINE int
+TAO_ORB_Parameters::use_multicast (void) const
+{
+ return this->use_multicast_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::use_multicast (int um)
+{
+ this->use_multicast_ = um;
+}