summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-26 23:27:30 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-05-26 23:27:30 +0000
commit5b434099b463872eb53b31d7018ddc04a9aaaa4e (patch)
tree60adf09aa427a50e79bdcf672cc060e1925d6e54
parentdffeb4dac653765e8e25beb12eeae2e8dfb74ab9 (diff)
downloadATCD-5b434099b463872eb53b31d7018ddc04a9aaaa4e.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c11
-rw-r--r--TAO/orbsvcs/Naming_Service/Naming_Service.h8
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp20
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h131
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp3
-rw-r--r--TAO/tao/ORB_Core.cpp20
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp12
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/server.h2
8 files changed, 115 insertions, 92 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index ff4534fc4b3..1a164611884 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,14 @@
+Tue May 26 18:15:40 1998 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu>
+
+ * orbsvcs/orbsvcs/Naming/CosNaming_i: Changed the implementation
+ so there's now an init() method that must be called before using
+ the NamingContext. This is necessary to make sure we don't try
+ to initialize the lock_ until the ORB has been initialized.
+
+ * orbsvcs/orbsvcs/Naming/Naming_Utils.cpp: Changed the
+ implementation to call init() on the NamingContext
+ implementation.
+
Tue May 26 16:24:41 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
* tao/Server_Request.h:
diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.h b/TAO/orbsvcs/Naming_Service/Naming_Service.h
index bcb8da6ca7d..5cb39adcabe 100644
--- a/TAO/orbsvcs/Naming_Service/Naming_Service.h
+++ b/TAO/orbsvcs/Naming_Service/Naming_Service.h
@@ -25,12 +25,12 @@
class Naming_Service
{
// = TITLE
- // Defines a class that encapsulates the implementation of a
- // naming service.
+ // Defines a class that encapsulates the implementation of the
+ // COS Naming Service.
//
// = DESCRIPTION
- // This class makes use of the TAO_Naming_Server and
- // TAO_ORB_Manager class to implement the Naming_Service.
+ // This class makes use of the <TAO_Naming_Server> and
+ // <TAO_ORB_Manager> class to implement the COS <Naming_Service>.
public:
Naming_Service (void);
// Default Constructor.
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
index 3695fd7bf71..36bd5eac8a6 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.cpp
@@ -16,17 +16,25 @@
#include "CosNaming_i.h"
-NS_NamingContext::NS_NamingContext (void)
+NS_NamingContext::NS_NamingContext (size_t default_hash_table_size)
: lock_ (0)
{
// Deal with faults.
- if (context_.open () == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "NS_NamingContext"));
-
- // Get the lock from the orb that knows what type is appropriate.
- this->lock_ = TAO_ORB_Core_instance ()->server_factory ()->create_servant_lock ();
+ if (context_.open (default_hash_table_size) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "NS_NamingContext"));
}
+int
+NS_NamingContext::init (void)
+{
+ // Get the lock from the ORB, which knows what type is appropriate.
+ ACE_ALLOCATOR_RETURN (this->lock_,
+ TAO_ORB_Core_instance ()->server_factory ()->create_servant_lock (),
+ -1);
+ return 0;
+}
NS_NamingContext::~NS_NamingContext (void)
{
delete this->lock_;
diff --git a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
index 294df2c274e..700a819d923 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/CosNaming_i.h
@@ -23,79 +23,79 @@
#include "ace/Synch.h"
class TAO_ORBSVCS_Export NS_NamingContext : public POA_CosNaming::NamingContext
+{
// = TITLE
- // This class implements the NamingContext interface that is part of the
- // CosNaming idl module.
+ // This class implements the NamingContext interface that is
+ // part of the CosNaming idl module.
//
// = DESCRIPTION
- // Extensive comments can be found in the idl file.
-{
- public:
+ // Extensive comments can be found in the Naming IDL file.
+public:
typedef ACE_Hash_Map_Manager<NS_ExtId, NS_IntId, ACE_Null_Mutex>
HASH_MAP;
- NS_NamingContext (void);
- // default constructor.
+ // = Initialization and termination methods.
+ NS_NamingContext (size_t default_hash_table_size = ACE_DEFAULT_MAP_SIZE);
+ // Default constructor, which initializes the <size> of the table.
+
+ int init (void);
+ // Initialize the lock. The ORB must be initialized when this
+ // constructor is called.
~NS_NamingContext (void);
// destructor.
-
virtual void bind (const CosNaming::Name &n,
CORBA::Object_ptr obj,
CORBA::Environment &IT_env);
-
- // create a binding for name <n> and object <obj> in the naming
- // context. Compound names are treated as follows: ctx->bind
- // (<c1; c2; c3; cn>, obj) = (ctx->resolve (<c1; c2;
- // cn-1>))->bind (<cn>, obj) if the there already exists a
- // binding for the specified name, <AlreadyBound> exception is
- // thrown. Naming contexts should be bound using <bind_context>
- // and <rebind_context> in order to participate in name
- // resolution later.
+ // Create a binding for name <n> and object <obj> in the naming
+ // context. Compound names are treated as follows: ctx->bind (<c1;
+ // c2; c3; cn>, obj) = (ctx->resolve (<c1; c2; cn-1>))->bind (<cn>,
+ // obj) if the there already exists a binding for the specified
+ // name, <AlreadyBound> exception is thrown. Naming contexts should
+ // be bound using <bind_context> and <rebind_context> in order to
+ // participate in name resolution later.
virtual void rebind (const CosNaming::Name &n,
CORBA::Object_ptr obj,
CORBA::Environment &IT_env);
- // this is similar to <bind> operation above, except for when
- // the binding for the specified name already exists in the
- // specified context. In that case, the existing binding is
- // replaced with the new one.
+ // This is similar to <bind> operation above, except for when the
+ // binding for the specified name already exists in the specified
+ // context. In that case, the existing binding is replaced with the
+ // new one.
virtual void bind_context (const CosNaming::Name &n,
CosNaming::NamingContext_ptr nc,
CORBA::Environment &IT_env);
// This is the version of <bind> specifically for binding naming
- // contexts, so that they will participate in name resolution
- // when compound names are passed to be resolved.
+ // contexts, so that they will participate in name resolution when
+ // compound names are passed to be resolved.
virtual void rebind_context (const CosNaming::Name &n,
CosNaming::NamingContext_ptr nc,
CORBA::Environment &IT_env);
- // This is a version of <rebind> specifically for naming
- // contexts, so that they can participate in name resolution
- // when compound names are passed.
+ // This is a version of <rebind> specifically for naming contexts,
+ // so that they can participate in name resolution when compound
+ // names are passed.
virtual CORBA::Object_ptr resolve (const CosNaming::Name &n,
CORBA::Environment &IT_env);
- // Return object reference that is bound to the name. Compound
- // name resolve is defined as follows: ctx->resolve (<c1; c2;
- // cn>) = ctx->resolve (<c1; c2 cn-1>)->resolve (<cn>) The
- // naming service does not return the type of the object.
- // Clients are responsible for "narrowing" the object to the
- // appropriate type.
+ // Return object reference that is bound to the name. Compound name
+ // resolve is defined as follows: ctx->resolve (<c1; c2; cn>) =
+ // ctx->resolve (<c1; c2 cn-1>)->resolve (<cn>) The naming service
+ // does not return the type of the object. Clients are responsible
+ // for "narrowing" the object to the appropriate type.
virtual void unbind (const CosNaming::Name &n,
CORBA::Environment &IT_env);
- // Remove the name binding from the context. When compound
- // names are used, unbind is defined as follows: ctx->unbind
- // (<c1; c2; cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind
- // (<cn>)
+ // Remove the name binding from the context. When compound names
+ // are used, unbind is defined as follows: ctx->unbind (<c1; c2;
+ // cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind (<cn>)
virtual CosNaming::NamingContext_ptr new_context (CORBA::Environment &IT_env);
- // This operation returns a new naming context implemented by
- // the same naming server in which the operation was invoked.
- // The context is not bound.
+ // This operation returns a new naming context implemented by the
+ // same naming server in which the operation was invoked. The
+ // context is not bound.
virtual CosNaming::NamingContext_ptr bind_new_context (const CosNaming::Name &n,
CORBA::Environment &IT_env);
@@ -105,23 +105,22 @@ class TAO_ORBSVCS_Export NS_NamingContext : public POA_CosNaming::NamingContext
// bound (the name argument excluding the last component).
virtual void destroy (CORBA::Environment &IT_env);
- // Delete the naming context. NOTE: the user should <unbind>
- // any bindings in which the given context is bound to some
- // names before invoking <destroy> operation on it. Ignoring
- // this rule may cause unexpected behaviour. <destroy> deletes
- // the context object if it is not bound to any names in the
- // given address space. <destroys> decrements the reference
- // count of the context if bindings to it exist.
+ // Delete the naming context. NOTE: the user should <unbind> any
+ // bindings in which the given context is bound to some names before
+ // invoking <destroy> operation on it. Ignoring this rule may cause
+ // unexpected behaviour. <destroy> deletes the context object if it
+ // is not bound to any names in the given address space. <destroys>
+ // decrements the reference count of the context if bindings to it
+ // exist.
virtual void list (CORBA::ULong how_many,
CosNaming::BindingList_out bl,
CosNaming::BindingIterator_out bi,
CORBA::Environment &IT_env);
- // Returns at most the requested number of bindings <how_many>
- // in <bl>. If the naming context contains additional bindings,
- // they are returned with a BindingIterator. In the naming
- // context does not contain any additional bindings <bi>
- // returned as null.
+ // Returns at most the requested number of bindings <how_many> in
+ // <bl>. If the naming context contains additional bindings, they
+ // are returned with a BindingIterator. In the naming context does
+ // not contain any additional bindings <bi> returned as null.
protected:
// = These are the helper methods used by other methods.
@@ -133,20 +132,19 @@ protected:
// (including the last component that doesn't need to be resolved)
// Returns a pointer to the target context.
- private:
-
+private:
HASH_MAP context_;
// This implementation of NamingContext uses ACE thread-safe Hash
// Map for storage and manipulation of name-object bindings.
ACE_Lock *lock_;
- // Lock to serialize access to the underlying data structure.
- // This is a lock adapter that hides the type of lock, which may be
- // a null lock, if the ORB decides it is not needed.
-
+ // Lock to serialize access to the underlying data structure. This
+ // is a lock adapter that hides the type of lock, which may be a
+ // null lock, if the ORB decides it is not needed.
};
class TAO_ORBSVCS_Export NS_BindingIterator : public POA_CosNaming::BindingIterator
+{
// = TITLE
// This class implements the BindingIterator interface
// that is part of the CosNaming idl module.
@@ -155,10 +153,10 @@ class TAO_ORBSVCS_Export NS_BindingIterator : public POA_CosNaming::BindingItera
// NS_BindingIterator constructor expects a pointer to a
// DYNAMICALLY allocated hash map iterator. Destructor
// deallocates hash map iterator.
-{
- public:
+public:
// = Intialization and termination methods.
- NS_BindingIterator (NS_NamingContext::HASH_MAP::ITERATOR *hash_iter, ACE_Lock * lock);
+ NS_BindingIterator (NS_NamingContext::HASH_MAP::ITERATOR *hash_iter,
+ ACE_Lock *lock);
// constructor.
~NS_BindingIterator (void);
@@ -166,25 +164,24 @@ class TAO_ORBSVCS_Export NS_BindingIterator : public POA_CosNaming::BindingItera
CORBA::Boolean next_one (CosNaming::Binding_out b,
CORBA::Environment &IT_env);
- // This operation returns the next binding. If there are no
- // more bindings false is returned.
+ // This operation returns the next binding. If there are no more
+ // bindings false is returned.
CORBA::Boolean next_n (CORBA::ULong how_many,
CosNaming::BindingList_out bl,
CORBA::Environment &IT_env);
- // This operation returns at most the requested number of
- // bindings.
+ // This operation returns at most the requested number of bindings.
void destroy (CORBA::Environment &IT_env);
// This operation destroys the iterator.
- private:
+private:
NS_NamingContext::HASH_MAP::ITERATOR *hash_iter_;
// A pointer to the hash map iterator.
ACE_Lock *lock_;
- // lock passed on from NS_NamingContext to serialize access
- // to the internal data structure.
+ // Lock passed on from NS_NamingContext to serialize access to the
+ // internal data structure.
};
#endif /* COSNAMING_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
index 4b1bd11f52f..2cf85bfa684 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
@@ -49,6 +49,9 @@ TAO_Naming_Server::init (CORBA::ORB_ptr orb,
int argc,
char **argv)
{
+ // Initialize our <NS_NamingContext> instance.
+ this->naming_context_impl_.init ();
+
// Parse command-line arguments to determine if this name server
// instance is part of a naming tree that resides under the default
// name server.
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index f0adaf2b146..40ac0f09fd0 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -677,19 +677,20 @@ TAO_ORB_Core::server_factory (void)
{
// Look in the service repository for an instance.
this->server_factory_ =
- ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance ("Server_Strategy_Factory");
-
+ ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance
+ ("Server_Strategy_Factory");
this->server_factory_from_service_config_ = CORBA::B_TRUE;
}
+ // If the <server_factory_> isn't found it's usually because the ORB
+ // hasn't been intialized correctly...
if (this->server_factory_ == 0)
{
- // Still don't have one, so let's allocate the default. This
- // will throw an exception if it fails on exception-throwing
- // platforms.
+ // Still don't have one, so let's allocate the default.
ACE_ERROR ((LM_WARNING,
- "(%P|%t) WARNING - No Server Strategy Factory found in Service Repository."
- " Using default instance.\n"));
+ "(%P|%t) WARNING - No %s found in Service Repository."
+ " Using default instance.\n",
+ "Server Strategy Factory"));
ACE_NEW_RETURN (this->server_factory_,
TAO_Default_Server_Strategy_Factory,
@@ -697,9 +698,10 @@ TAO_ORB_Core::server_factory (void)
this->server_factory_from_service_config_ = CORBA::B_FALSE;
// At this point we need to register this with the
- // Service_Repository in order to get it cleaned up properly.
- // But, for now we let it leak.
+ // <Service_Repository> to get it cleaned up properly. But, for
+ // now we let it leak.
}
+
return this->server_factory_;
}
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
index f0c910bf05e..ce7961b384a 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
@@ -56,8 +56,8 @@ Cubit_Server::init (int argc,
char** argv,
CORBA::Environment& env)
{
- // Call the init of TAO_ORB_Manager to create a child POA
- // under the root POA.
+ // 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,
"child_poa",
@@ -84,7 +84,9 @@ Cubit_Server::init (int argc,
if (this->ior_output_file_)
{
- ACE_OS::fprintf (this->ior_output_file_, "%s", str.in ());
+ ACE_OS::fprintf (this->ior_output_file_,
+ "%s",
+ str.in ());
ACE_OS::fclose (this->ior_output_file_);
}
@@ -154,10 +156,10 @@ main (int argc, char *argv[])
Cubit_Server cubit_server;
ACE_DEBUG ((LM_DEBUG,
- "\n \t IDL_Cubit:SERVER \n \n"));
+ "\n\tIDL_Cubit:SERVER\n\n"));
TAO_TRY
{
- if (cubit_server.init (argc,argv,TAO_TRY_ENV) == -1)
+ if (cubit_server.init (argc, argv, TAO_TRY_ENV) == -1)
return 1;
else
{
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/server.h b/TAO/tests/Cubit/TAO/IDL_Cubit/server.h
index f97d6b75285..f60714cb223 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/server.h
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/server.h
@@ -39,7 +39,7 @@ class Cubit_Server
// init to initialize the cubit_server's state and then call run
// to run the orb.
public:
-
+ // = Initialization and termination methods.
Cubit_Server (void);
// Default constructor