summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-07-05 23:00:52 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-07-05 23:00:52 +0000
commite453e5e83aa3b7d84195bf80b2bff3fd4a5b7799 (patch)
treec1ccde65e9f7210c6911981e8aa0f8ff1e72fdbe
parent6c44b5a341e87717fff0af5de3b0d16d05e08d63 (diff)
downloadATCD-e453e5e83aa3b7d84195bf80b2bff3fd4a5b7799.tar.gz
More Thread Pool changes....
-rw-r--r--TAO/tao/Acceptor_Filter.h4
-rw-r--r--TAO/tao/Acceptor_Registry.cpp21
-rw-r--r--TAO/tao/Acceptor_Registry.h9
-rw-r--r--TAO/tao/ORB_Core.cpp7
-rw-r--r--TAO/tao/PortableServer/Default_Acceptor_Filter.cpp7
-rw-r--r--TAO/tao/PortableServer/Default_Acceptor_Filter.h14
-rw-r--r--TAO/tao/PortableServer/POA.cpp85
-rw-r--r--TAO/tao/PortableServer/POA.h8
-rw-r--r--TAO/tao/PortableServer/POA_Cached_Policies.cpp19
-rw-r--r--TAO/tao/RTCORBA/RT_PolicyFactory.cpp1
-rw-r--r--TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp9
-rw-r--r--TAO/tao/RTPortableServer/RT_Acceptor_Filters.h14
-rw-r--r--TAO/tao/RTPortableServer/RT_POA.cpp2
-rw-r--r--TAO/tao/RTPortableServer/RT_Policy_Validator.cpp30
14 files changed, 164 insertions, 66 deletions
diff --git a/TAO/tao/Acceptor_Filter.h b/TAO/tao/Acceptor_Filter.h
index 40c3680f482..be87e6acb81 100644
--- a/TAO/tao/Acceptor_Filter.h
+++ b/TAO/tao/Acceptor_Filter.h
@@ -56,6 +56,10 @@ public:
TAO_MProfile &mprofile,
TAO_Acceptor **acceptors_begin,
TAO_Acceptor **acceptors_end) = 0;
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ virtual int encode_endpoints (TAO_MProfile &mprofile) = 0;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp
index 027f7aa6c8d..1bfef2863cf 100644
--- a/TAO/tao/Acceptor_Registry.cpp
+++ b/TAO/tao/Acceptor_Registry.cpp
@@ -48,27 +48,6 @@ TAO_Acceptor_Registry::endpoint_count (void)
}
int
-TAO_Acceptor_Registry::make_mprofile (const TAO_ObjectKey &object_key,
- TAO_MProfile &mprofile,
- TAO_Acceptor_Filter *filter)
-{
- // Allocate space for storing the profiles. There can never be more
- // profiles than there are endpoints. In some cases, there can be
- // fewer profiles than endpoints.
- size_t pfile_count = this->endpoint_count ();
- if (mprofile.set (pfile_count) < 0)
- return -1;
-
- // Leave it to the filter to decide which acceptors/in which order
- // go into the mprofile.
- return filter->fill_mprofile (object_key,
- mprofile,
- this->begin (),
- this->end ());
-
-}
-
-int
TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile)
{
TAO_AcceptorSetIterator end = this->end ();
diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h
index 386e3bec198..d352a4cc70e 100644
--- a/TAO/tao/Acceptor_Registry.h
+++ b/TAO/tao/Acceptor_Registry.h
@@ -74,15 +74,6 @@ public:
/// Returns the total number of endpoints in all of its acceptors.
size_t endpoint_count (void);
- /**
- * Use <filter> to populate <mprofile> object with profiles.
- * Different filters implement different strategies for selection
- * of endpoints to be included into <mprofile>.
- */
- int make_mprofile (const TAO_ObjectKey& object_key,
- TAO_MProfile &mprofile,
- TAO_Acceptor_Filter *filter);
-
/// Check if there is at least one profile in <mprofile> that
/// corresponds to a collocated object.
int is_collocated (const TAO_MProfile& mprofile);
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index dd4f0d595d8..500632500f0 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1386,6 +1386,9 @@ TAO_ORB_Core::thread_lane_resources_manager (void)
TAO_Default_Thread_Lane_Resources_Manager,
0);
+ // Initialize the resources.
+ thread_lane_resources_manager->initialize (*this);
+
// Store a copy for later use.
this->thread_lane_resources_manager_ = thread_lane_resources_manager;
}
@@ -1867,9 +1870,6 @@ TAO_ORB_Core::create_stub_object (TAO_MProfile &mprofile,
CORBA::PolicyList *policy_list,
CORBA::Environment &ACE_TRY_ENV)
{
- (void) this->open (ACE_TRY_ENV);
- ACE_CHECK_RETURN (0);
-
// Add the Polices contained in "policy_list" to each profile so
// that those policies will be exposed to the client in the IOR. In
// particular each CORBA::Policy has to be converted in to
@@ -1878,7 +1878,6 @@ TAO_ORB_Core::create_stub_object (TAO_MProfile &mprofile,
// became in turns the "body" of the IOP::TaggedComponent. This
// conversion is a responsability of the CORBA::Profile class. (See
// orbos\98-05-05.pdf Section 5.4)
-
if (policy_list->length () != 0)
{
TAO_Profile * profile;
diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp
index 21f4cfd3249..b55e3005a5d 100644
--- a/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp
+++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp
@@ -28,3 +28,10 @@ TAO_Default_Acceptor_Filter::fill_mprofile (const TAO_ObjectKey &object_key,
return 0;
}
+
+int
+TAO_Default_Acceptor_Filter::encode_endpoints (TAO_MProfile &)
+{
+ // No encoding required.
+ return 0;
+}
diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.h b/TAO/tao/PortableServer/Default_Acceptor_Filter.h
index 5e8f772022e..737888a0992 100644
--- a/TAO/tao/PortableServer/Default_Acceptor_Filter.h
+++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.h
@@ -52,11 +52,15 @@ class TAO_PortableServer_Export TAO_Default_Acceptor_Filter : public TAO_Accepto
public:
TAO_Default_Acceptor_Filter (void);
- virtual int fill_mprofile (const TAO_ObjectKey &object_key,
- TAO_MProfile &mprofile,
- TAO_Acceptor **acceptors_begin,
- TAO_Acceptor **acceptors_end);
- // Populate <mprofile> with all available endpoints.
+ /// Populate <mprofile> with all available endpoints.
+ int fill_mprofile (const TAO_ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end);
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ int encode_endpoints (TAO_MProfile &mprofile);
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp
index 8604f49107b..ba095af2f96 100644
--- a/TAO/tao/PortableServer/POA.cpp
+++ b/TAO/tao/PortableServer/POA.cpp
@@ -14,6 +14,8 @@
#include "tao/ORB_Core.h"
#include "tao/ORB.h"
#include "tao/Server_Strategy_Factory.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
#include "tao/Environment.h"
#include "tao/Exception.h"
#include "tao/Stub.h"
@@ -3230,22 +3232,95 @@ TAO_POA::key_to_stub_i (const TAO_ObjectKey &key,
CORBA::Short priority,
CORBA_Environment &ACE_TRY_ENV)
{
+ (void) this->orb_core_.open (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
CORBA::PolicyList_var client_exposed_policies =
this->client_exposed_policies (priority,
ACE_TRY_ENV);
ACE_CHECK_RETURN (0);
TAO_Default_Acceptor_Filter filter;
- TAO_Stub *data = this->orb_core_.create_stub_object (key,
- type_id,
- client_exposed_policies._retn (),
- &filter,
- ACE_TRY_ENV);
+ TAO_Stub *data =
+ this->create_stub_object (key,
+ type_id,
+ client_exposed_policies._retn (),
+ &filter,
+ ACE_TRY_ENV);
ACE_CHECK_RETURN (0);
return data;
}
+TAO_Stub *
+TAO_POA::create_stub_object (const TAO_ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ int error = 0;
+ TAO_Acceptor_Registry &acceptor_registry =
+ this->orb_core_.lane_resources ().acceptor_registry ();
+
+ // Count the number of endpoints.
+ size_t profile_count =
+ acceptor_registry.endpoint_count ();
+
+ // Create a profile container and have acceptor registries populate
+ // it with profiles as appropriate.
+ TAO_MProfile mprofile (0);
+
+ // Allocate space for storing the profiles. There can never be more
+ // profiles than there are endpoints. In some cases, there can be
+ // less profiles than endpoints.
+ int result =
+ mprofile.set (profile_count);
+ if (result == -1)
+ error = 1;
+
+ if (!error)
+ {
+ result =
+ filter->fill_mprofile (object_key,
+ mprofile,
+ acceptor_registry.begin (),
+ acceptor_registry.end ());
+ if (result == -1)
+ error = 1;
+ }
+
+ if (!error)
+ result = filter->encode_endpoints (mprofile);
+ if (result == -1)
+ error = 1;
+
+ if (error)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ // Make sure we have at least one profile. <mp> may end up being
+ // empty if none of the acceptor endpoints have the right priority
+ // for this object, for example.
+ if (mprofile.profile_count () == 0)
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ return
+ this->orb_core_.create_stub_object (mprofile,
+ type_id,
+ policy_list,
+ ACE_TRY_ENV);
+}
+
CORBA::PolicyList *
TAO_POA::client_exposed_policies (CORBA::Short object_priority,
CORBA_Environment &ACE_TRY_ENV)
diff --git a/TAO/tao/PortableServer/POA.h b/TAO/tao/PortableServer/POA.h
index 9f25c5073c6..a2143dcb923 100644
--- a/TAO/tao/PortableServer/POA.h
+++ b/TAO/tao/PortableServer/POA.h
@@ -139,7 +139,7 @@ public:
friend class TAO_POA_Manager;
typedef ACE_CString String;
-
+
/**
* This method is used to downcast safely an instance of PortableServer::POA
* to an instance of TAO_POA when RTTI is not enabled.
@@ -487,6 +487,12 @@ protected:
CORBA_Environment &ACE_TRY_ENV);
// Like key_to_stub() but assume that the ORB is not shutting down.
+ TAO_Stub *create_stub_object (const TAO_ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ CORBA::Environment &ACE_TRY_ENV);
+
int is_servant_in_map (PortableServer::Servant servant);
int is_user_id_in_map (const PortableServer::ObjectId &user_id,
diff --git a/TAO/tao/PortableServer/POA_Cached_Policies.cpp b/TAO/tao/PortableServer/POA_Cached_Policies.cpp
index 542aa912b9b..3d7df32ccc1 100644
--- a/TAO/tao/PortableServer/POA_Cached_Policies.cpp
+++ b/TAO/tao/PortableServer/POA_Cached_Policies.cpp
@@ -12,15 +12,15 @@ ACE_RCSID(tao, POA, "$Id$")
TAO_POA_Cached_Policies::TAO_POA_Cached_Policies ()
- : thread_ (PortableServer::ORB_CTRL_MODEL),
- lifespan_ (PortableServer::TRANSIENT),
- id_uniqueness_ (PortableServer::UNIQUE_ID),
- id_assignment_ (PortableServer::SYSTEM_ID),
- implicit_activation_ (PortableServer::NO_IMPLICIT_ACTIVATION),
- servant_retention_ (PortableServer::RETAIN),
- request_processing_ (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
- priority_model_ (TAO_POA_Cached_Policies::CLIENT_PROPAGATED),
- server_priority_ (TAO_INVALID_PRIORITY)
+ : thread_ (PortableServer::ORB_CTRL_MODEL),
+ lifespan_ (PortableServer::TRANSIENT),
+ id_uniqueness_ (PortableServer::UNIQUE_ID),
+ id_assignment_ (PortableServer::SYSTEM_ID),
+ implicit_activation_ (PortableServer::NO_IMPLICIT_ACTIVATION),
+ servant_retention_ (PortableServer::RETAIN),
+ request_processing_ (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
+ priority_model_ (TAO_POA_Cached_Policies::CLIENT_PROPAGATED),
+ server_priority_ (TAO_INVALID_PRIORITY)
{
}
@@ -147,4 +147,3 @@ TAO_POA_Cached_Policies::update_policy (const CORBA::Policy_ptr policy,
#endif /* TAO_HAS_MINIMUM_POA == 0 */
}
-
diff --git a/TAO/tao/RTCORBA/RT_PolicyFactory.cpp b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
index 39306126890..87420a3953a 100644
--- a/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
+++ b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
@@ -66,4 +66,3 @@ TAO_RT_PolicyFactory::create_policy (
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
CORBA::Policy::_nil ());
}
-
diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
index d1c1984f4d8..3bb0531d4e8 100644
--- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
+++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
@@ -41,6 +41,13 @@ fill_mprofile (const TAO_ObjectKey &object_key,
return -1;
}
+ return 0;
+}
+
+int
+TAO_Server_Protocol_Acceptor_Filter::
+encode_endpoints (TAO_MProfile &mprofile)
+{
// Encode endpoints.
for (CORBA::ULong i = 0;
i < mprofile.profile_count ();
@@ -53,7 +60,6 @@ fill_mprofile (const TAO_ObjectKey &object_key,
return 0;
}
-
int
TAO_Server_Protocol_Acceptor_Filter::
validate_acceptor (TAO_Acceptor * /*acceptor*/)
@@ -96,4 +102,3 @@ TAO_Bands_Acceptor_Filter::validate_acceptor (TAO_Acceptor *acceptor)
}
return 0;
}
-
diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h
index 41c4722c4e4..f61f5adb846 100644
--- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h
+++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h
@@ -55,11 +55,15 @@ class TAO_RTPortableServer_Export TAO_Server_Protocol_Acceptor_Filter :
public:
TAO_Server_Protocol_Acceptor_Filter (RTCORBA::ProtocolList &protocols);
- virtual int fill_mprofile (const TAO_ObjectKey &object_key,
- TAO_MProfile &mprofile,
- TAO_Acceptor **acceptors_begin,
- TAO_Acceptor **acceptors_end);
- // Populate <mprofile> based on what's in <protocols_>.
+ /// Populate <mprofile> based on what's in <protocols_>.
+ int fill_mprofile (const TAO_ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end);
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ int encode_endpoints (TAO_MProfile &mprofile);
virtual int validate_acceptor (TAO_Acceptor *acceptor);
// Template method pattern. This method is used by <fill_mprofile>
diff --git a/TAO/tao/RTPortableServer/RT_POA.cpp b/TAO/tao/RTPortableServer/RT_POA.cpp
index cfdd7d3a3bb..d41a40e66a8 100644
--- a/TAO/tao/RTPortableServer/RT_POA.cpp
+++ b/TAO/tao/RTPortableServer/RT_POA.cpp
@@ -89,7 +89,6 @@ void
TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies,
CORBA::Environment &ACE_TRY_ENV)
{
-
CORBA::Policy_var policy =
policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);
@@ -762,4 +761,3 @@ TAO_RT_POA::id (CORBA::Environment &ACE_TRY_ENV)
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
index f962b9727bf..e5472a659ab 100644
--- a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
+++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
@@ -32,12 +32,15 @@ TAO_POA_RT_Policy_Validator::validate_impl (TAO_Policy_Set &policies,
this->validate_priorities (policies, ACE_TRY_ENV);
ACE_CHECK;
+ this->validate_thread_pool (policies, ACE_TRY_ENV);
+ ACE_CHECK;
}
CORBA::Boolean
TAO_POA_RT_Policy_Validator::legal_policy_impl (CORBA::PolicyType type)
{
return (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE ||
+ type == RTCORBA::THREADPOOL_POLICY_TYPE ||
type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE ||
type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE ||
type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE);
@@ -82,7 +85,7 @@ TAO_POA_RT_Policy_Validator::validate_server_protocol (TAO_Policy_Set &policies,
void
TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::Environment &ACE_TRY_ENV)
{
// Initialize to the default priority/priority model.
RTCORBA::Priority priority = TAO_INVALID_PRIORITY;
@@ -198,3 +201,28 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies,
ACE_THROW (CORBA::BAD_PARAM ());
}
}
+
+void
+TAO_POA_RT_Policy_Validator::validate_thread_pool (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL);
+
+ RTCORBA::ThreadpoolPolicy_var thread_pool =
+ RTCORBA::ThreadpoolPolicy::_narrow (policy.in (),
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (thread_pool.in ()))
+ {
+ RTCORBA::ThreadpoolId thread_pool_id =
+ = thread_pool->thread_pool (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ // Check that the thread pool id is valid.
+ int result =
+ find (thread_pool_id);
+ if (result != 0)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }