summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-03 09:52:19 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-03 09:52:19 +0000
commit4bccae82f60bd3e8890c332dde6c1db795c0ef88 (patch)
tree7ef9d6f0e60aa8cef4896523edb91ac18c2a2373
parent0397964836732fcca9bc769fe31f4cc42cff6e49 (diff)
downloadATCD-4bccae82f60bd3e8890c332dde6c1db795c0ef88.tar.gz
Fixed Server Protocol handling; Added new Policy Combination test.
-rw-r--r--TAO/tao/PortableServer/Default_Policy_Validator.cpp6
-rw-r--r--TAO/tao/PortableServer/Default_Policy_Validator.h8
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp54
-rw-r--r--TAO/tao/PortableServer/POA.cpp12
-rw-r--r--TAO/tao/PortableServer/Policy_Validator.cpp18
-rw-r--r--TAO/tao/PortableServer/Policy_Validator.h9
-rw-r--r--TAO/tao/RTPortableServer/RT_POA_Initializer.cpp36
-rw-r--r--TAO/tao/RTPortableServer/RT_POA_Initializer.h4
-rw-r--r--TAO/tao/RTPortableServer/RT_Policy_Validator.cpp29
-rw-r--r--TAO/tao/RTPortableServer/RT_Policy_Validator.h8
-rw-r--r--TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp18
-rw-r--r--TAO/tests/RTCORBA/Banded_Connections/client.cpp6
-rw-r--r--TAO/tests/RTCORBA/Banded_Connections/server.cpp32
13 files changed, 134 insertions, 106 deletions
diff --git a/TAO/tao/PortableServer/Default_Policy_Validator.cpp b/TAO/tao/PortableServer/Default_Policy_Validator.cpp
index 52d45adbd4a..b53222baed7 100644
--- a/TAO/tao/PortableServer/Default_Policy_Validator.cpp
+++ b/TAO/tao/PortableServer/Default_Policy_Validator.cpp
@@ -110,3 +110,9 @@ TAO_POA_Default_Policy_Validator::legal_policy_impl (CORBA::PolicyType type)
type == PortableServer::SERVANT_RETENTION_POLICY_ID ||
type == PortableServer::REQUEST_PROCESSING_POLICY_ID);
}
+
+void
+TAO_POA_Default_Policy_Validator::merge_policies_impl (TAO_Policy_Set &,
+ CORBA::Environment &)
+{
+}
diff --git a/TAO/tao/PortableServer/Default_Policy_Validator.h b/TAO/tao/PortableServer/Default_Policy_Validator.h
index 0c534bfeef8..19191498ed2 100644
--- a/TAO/tao/PortableServer/Default_Policy_Validator.h
+++ b/TAO/tao/PortableServer/Default_Policy_Validator.h
@@ -39,8 +39,12 @@ protected:
* are consistent and legal. Throw an appropriate exception
* if that is not the case.
*/
- virtual void validate_impl (TAO_Policy_Set &policies,
- CORBA::Environment &ACE_TRY_ENV);
+ void validate_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /// Add/merge policies.
+ void merge_policies_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV);
/**
* Return whether the specified policy type is legal for the
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index c820ed01f71..3bc49dfa041 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -581,21 +581,6 @@ TAO_Object_Adapter::open (CORBA::Environment &ACE_TRY_ENV)
PortableServer::POAManager_var safe_poa_manager = poa_manager;
- TAO_POA_Policy_Set policies (this->default_poa_policies ());
-
-#if (TAO_HAS_MINIMUM_POA == 0)
- // Specify the implicit activation policy since it should
- // be different from the default. Note that merge_policy
- // takes a const reference and makes its own copy of the
- // policy. (Otherwise, we'd have to allocate the policy
- // on the heap.)
- TAO_Implicit_Activation_Policy
- implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION);
-
- policies.merge_policy (&implicit_activation_policy,
- ACE_TRY_ENV);
-#endif /* TAO_HAS_MINIMUM_POA == 0 */
-
// This makes sure that the default resources are open when the Root
// POA is created.
this->orb_core_.thread_lane_resources_manager ().open_default_resources (ACE_TRY_ENV);
@@ -615,17 +600,38 @@ TAO_Object_Adapter::open (CORBA::Environment &ACE_TRY_ENV)
ACE_TRY_ENV);
ACE_CHECK;
+ TAO_POA_Policy_Set policies (this->default_poa_policies ());
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ // Specify the implicit activation policy since it should
+ // be different from the default. Note that merge_policy
+ // takes a const reference and makes its own copy of the
+ // policy. (Otherwise, we'd have to allocate the policy
+ // on the heap.)
+ TAO_Implicit_Activation_Policy
+ implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION);
+
+ policies.merge_policy (&implicit_activation_policy,
+ ACE_TRY_ENV);
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // Merge policies from the ORB level.
+ this->validator ().merge_policies (policies.policies (),
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
// Construct a new POA
TAO_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME);
- this->root_ = this->servant_dispatcher_->create_POA (root_poa_name,
- *poa_manager,
- policies,
- 0,
- this->lock (),
- this->thread_lock (),
- this->orb_core_,
- this,
- ACE_TRY_ENV);
+ this->root_ =
+ this->servant_dispatcher_->create_POA (root_poa_name,
+ *poa_manager,
+ policies,
+ 0,
+ this->lock (),
+ this->thread_lock (),
+ this->orb_core_,
+ this,
+ ACE_TRY_ENV);
ACE_CHECK;
// The Object_Adapter will keep a reference to the Root POA so that
diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp
index 48b45400f33..33363685215 100644
--- a/TAO/tao/PortableServer/POA.cpp
+++ b/TAO/tao/PortableServer/POA.cpp
@@ -380,6 +380,11 @@ TAO_POA::create_POA_i (const char *adapter_name,
// default POA policies.
TAO_POA_Policy_Set tao_policies (this->object_adapter ().default_poa_policies ());
+ // Merge policies from the ORB level.
+ this->object_adapter ().validator ().merge_policies (tao_policies.policies (),
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
// Merge in any policies that the user may have specified.
tao_policies.merge_policies (policies,
ACE_TRY_ENV);
@@ -1707,7 +1712,7 @@ TAO_POA::servant_to_id_i (PortableServer::Servant servant,
// object map.
PortableServer::ObjectId_var user_id;
if (this->active_object_map ().bind_using_system_id_returning_user_id (servant,
- TAO_INVALID_PRIORITY,
+ this->cached_policies_.server_priority (),
user_id.out ()) != 0)
{
ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
@@ -1870,7 +1875,8 @@ TAO_POA::servant_to_reference (PortableServer::Servant servant,
// reference. The real requirement here is that a reference is
// produced that will behave appropriately (that is, yield a
// consistent Object Id value when asked politely).
- CORBA::Short priority = TAO_INVALID_PRIORITY;
+ CORBA::Short priority =
+ this->cached_policies_.server_priority ();
PortableServer::ObjectId_var id = this->servant_to_system_id (servant,
priority,
ACE_TRY_ENV);
@@ -3367,7 +3373,7 @@ TAO_POA::imr_notify_startup (CORBA_Environment &ACE_TRY_ENV)
// Activate the servant in the root poa.
PortableServer::ObjectId_var id =
root_poa->activate_object_i (this->server_object_,
- TAO_INVALID_PRIORITY,
+ this->cached_policies_.server_priority (),
ACE_TRY_ENV);
ACE_CHECK;
diff --git a/TAO/tao/PortableServer/Policy_Validator.cpp b/TAO/tao/PortableServer/Policy_Validator.cpp
index 596de7f2454..b6a0e90ea2d 100644
--- a/TAO/tao/PortableServer/Policy_Validator.cpp
+++ b/TAO/tao/PortableServer/Policy_Validator.cpp
@@ -24,7 +24,7 @@ void
TAO_POA_Policy_Validator::add_validator (TAO_POA_Policy_Validator *validator)
{
if (this->last_ == 0)
- this->last_ = this->next_ = validator;
+ this->last_ = this->next_ = validator;
else
this->last_ = this->last_->next_ = validator;
}
@@ -32,7 +32,7 @@ TAO_POA_Policy_Validator::add_validator (TAO_POA_Policy_Validator *validator)
void
TAO_POA_Policy_Validator::validate (TAO_Policy_Set &policies,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::Environment &ACE_TRY_ENV)
{
this->validate_impl (policies, ACE_TRY_ENV);
ACE_CHECK;
@@ -44,6 +44,20 @@ TAO_POA_Policy_Validator::validate (TAO_Policy_Set &policies,
}
}
+void
+TAO_POA_Policy_Validator::merge_policies (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ this->merge_policies_impl (policies, ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (this->next_ != 0)
+ {
+ this->next_->merge_policies (policies, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+}
+
CORBA::Boolean
TAO_POA_Policy_Validator::legal_policy (CORBA::PolicyType type)
{
diff --git a/TAO/tao/PortableServer/Policy_Validator.h b/TAO/tao/PortableServer/Policy_Validator.h
index 78b61bad571..f9d94ef0630 100644
--- a/TAO/tao/PortableServer/Policy_Validator.h
+++ b/TAO/tao/PortableServer/Policy_Validator.h
@@ -46,6 +46,12 @@ public:
CORBA::Environment &ACE_TRY_ENV);
/**
+ * Add/merge policies.
+ **/
+ void merge_policies (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /**
* Return whether the specified policy type is legal for the
* current configuration. This is needed since the user can
* potentially specify policies that are unknown to an
@@ -67,6 +73,9 @@ protected:
virtual void validate_impl (TAO_Policy_Set &policies,
CORBA::Environment &ACE_TRY_ENV) = 0;
+ virtual void merge_policies_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV) = 0;
+
virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0;
TAO_ORB_Core &orb_core_;
diff --git a/TAO/tao/RTPortableServer/RT_POA_Initializer.cpp b/TAO/tao/RTPortableServer/RT_POA_Initializer.cpp
index 6246591db3e..d4552cff9b7 100644
--- a/TAO/tao/RTPortableServer/RT_POA_Initializer.cpp
+++ b/TAO/tao/RTPortableServer/RT_POA_Initializer.cpp
@@ -30,40 +30,4 @@ TAO_RT_POA_Initializer::register_hooks_impl (TAO_Object_Adapter &object_adapter,
TAO_POA_RT_Policy_Validator (object_adapter.orb_core ()));
object_adapter.validator ().add_validator (rt_validator);
-
- // Add the default RT policies to the list of default POA policies.
- this->init_rt_default_policies (object_adapter.default_poa_policies (),
- object_adapter.orb_core (),
- ACE_TRY_ENV);
-
-}
-
-void
-TAO_RT_POA_Initializer::init_rt_default_policies (TAO_POA_Policy_Set &policies,
- TAO_ORB_Core &orb_core,
- CORBA::Environment &ACE_TRY_ENV)
-{
- CORBA::Policy_var policy =
- orb_core.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);
- if (!CORBA::is_nil (policy.in ()))
- {
- policies.merge_policy (policy.in (), ACE_TRY_ENV);
- ACE_CHECK;
- }
-
- CORBA::Policy_var protocol =
- orb_core.get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL);
- if (!CORBA::is_nil (protocol.in ()))
- {
- policies.merge_policy (protocol.in (), ACE_TRY_ENV);
- ACE_CHECK;
- }
-
- CORBA::Policy_var thread_pool =
- orb_core.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL);
- if (!CORBA::is_nil (thread_pool.in ()))
- {
- policies.merge_policy (thread_pool.in (), ACE_TRY_ENV);
- ACE_CHECK;
- }
}
diff --git a/TAO/tao/RTPortableServer/RT_POA_Initializer.h b/TAO/tao/RTPortableServer/RT_POA_Initializer.h
index 1a48039fa0b..bd1bdfa1e7a 100644
--- a/TAO/tao/RTPortableServer/RT_POA_Initializer.h
+++ b/TAO/tao/RTPortableServer/RT_POA_Initializer.h
@@ -37,10 +37,6 @@ protected:
virtual void register_hooks_impl (TAO_Object_Adapter &object_adapter,
CORBA::Environment &ACE_TRY_ENV);
-
- void init_rt_default_policies (TAO_POA_Policy_Set &policies,
- TAO_ORB_Core &orb_core,
- CORBA::Environment &ACE_TRY_ENV);
};
#include "ace/post.h"
diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
index 181e8927bb8..35093e5e2fa 100644
--- a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
+++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
@@ -288,6 +288,35 @@ TAO_POA_RT_Policy_Validator::validate_thread_pool (TAO_Policy_Set &policies,
ACE_CHECK;
}
+void
+TAO_POA_RT_Policy_Validator::merge_policies_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ CORBA::Policy_var policy =
+ this->orb_core_.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);
+ if (!CORBA::is_nil (policy.in ()))
+ {
+ policies.set_policy (policy.in (), ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+
+ CORBA::Policy_var protocol =
+ this->orb_core_.get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL);
+ if (!CORBA::is_nil (protocol.in ()))
+ {
+ policies.set_policy (protocol.in (), ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+
+ CORBA::Policy_var thread_pool =
+ this->orb_core_.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL);
+ if (!CORBA::is_nil (thread_pool.in ()))
+ {
+ policies.set_policy (thread_pool.in (), ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+}
+
/* static */
TAO_Thread_Pool *
TAO_POA_RT_Policy_Validator::extract_thread_pool (TAO_ORB_Core &orb_core,
diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.h b/TAO/tao/RTPortableServer/RT_Policy_Validator.h
index 493f6db0f43..5af4d403c84 100644
--- a/TAO/tao/RTPortableServer/RT_Policy_Validator.h
+++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.h
@@ -52,8 +52,12 @@ protected:
* are consistent and legal. Throw an appropriate exception
* if that is not the case.
*/
- virtual void validate_impl (TAO_Policy_Set &policies,
- CORBA::Environment &ACE_TRY_ENV);
+ void validate_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV);
+
+ /// Add/merge policies.
+ void merge_policies_impl (TAO_Policy_Set &policies,
+ CORBA::Environment &ACE_TRY_ENV);
/**
* Return whether the specified policy type is legal for the
diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp
index b7bb51f6879..06d591d8a63 100644
--- a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp
+++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp
@@ -144,6 +144,18 @@ RT_Priority_Model_Processing::pre_invoke (
else
priority_model = "RTCORBA::SERVER_DECLARED";
+ char thread_pool_id[BUFSIZ];
+ if (TAO_debug_level > 0)
+ {
+ if (thread_pool == 0)
+ ACE_OS::strcpy (thread_pool_id,
+ "default thread pool");
+ else
+ ACE_OS::sprintf (thread_pool_id,
+ "thread pool %d",
+ thread_pool->id ());
+ }
+
// Change the priority of the current thread for the duration of
// request.
if (target_priority != TAO_INVALID_PRIORITY &&
@@ -152,10 +164,11 @@ RT_Priority_Model_Processing::pre_invoke (
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("%s processing ")
+ ACE_TEXT ("%s processing using %s ")
ACE_TEXT ("(%P|%t): original thread priority %d ")
ACE_TEXT ("temporarily changed to %d\n"),
priority_model,
+ thread_pool_id,
original_priority_,
target_priority));
}
@@ -169,10 +182,11 @@ RT_Priority_Model_Processing::pre_invoke (
}
else if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("%s processing ")
+ ACE_TEXT ("%s processing using %s ")
ACE_TEXT ("(%P|%t): original thread priority = ")
ACE_TEXT ("target priority = %d\n"),
priority_model,
+ thread_pool_id,
target_priority));
}
diff --git a/TAO/tests/RTCORBA/Banded_Connections/client.cpp b/TAO/tests/RTCORBA/Banded_Connections/client.cpp
index f524a2f985a..a23e257a1f7 100644
--- a/TAO/tests/RTCORBA/Banded_Connections/client.cpp
+++ b/TAO/tests/RTCORBA/Banded_Connections/client.cpp
@@ -183,8 +183,9 @@ main (int argc, char *argv[])
CORBA::Object_var object =
orb->resolve_initial_references ("RTORB", ACE_TRY_ENV);
ACE_TRY_CHECK;
- RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in (),
- ACE_TRY_ENV);
+ RTCORBA::RTORB_var rt_orb =
+ RTCORBA::RTORB::_narrow (object.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
if (check_for_nil (rt_orb.in (), "RTORB") == -1)
return 1;
@@ -346,4 +347,3 @@ main (int argc, char *argv[])
return 0;
}
-
diff --git a/TAO/tests/RTCORBA/Banded_Connections/server.cpp b/TAO/tests/RTCORBA/Banded_Connections/server.cpp
index b4681a5156f..3776d44cdce 100644
--- a/TAO/tests/RTCORBA/Banded_Connections/server.cpp
+++ b/TAO/tests/RTCORBA/Banded_Connections/server.cpp
@@ -4,7 +4,6 @@
#include "ace/Get_Opt.h"
#include "ace/Read_Buffer.h"
#include "tao/RTCORBA/RTCORBA.h"
-#include "tao/RTCORBA/Pool_Per_Endpoint.h"
#include "tao/RTPortableServer/RTPortableServer.h"
#include "tao/Strategies/advanced_resource.h"
@@ -365,8 +364,9 @@ main (int argc, char *argv[])
CORBA::Object_var object =
orb->resolve_initial_references ("RTORB", ACE_TRY_ENV);
ACE_TRY_CHECK;
- RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in (),
- ACE_TRY_ENV);
+ RTCORBA::RTORB_var rt_orb =
+ RTCORBA::RTORB::_narrow (object.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
if (check_for_nil (rt_orb.in (), "RTORB") == -1)
return 1;
@@ -398,26 +398,8 @@ main (int argc, char *argv[])
Test_i server_impl (orb.in (), bands);
Test_i server_impl2 (orb.in (), bands);
-
- // Test 1: Attempt to create a POA with priority bands but
- // without the priority model. Should get POA::InvalidPolicy
- // exception.
- ACE_DEBUG ((LM_DEBUG,
- "\n Test 1\n"));
-
CORBA::PolicyList poa_policy_list;
poa_policy_list.length (1);
- poa_policy_list[0] =
- rt_orb->create_priority_banded_connection_policy
- (bands,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- poa_creation_exception_test (root_poa.in (),
- poa_manager.in (),
- poa_policy_list,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
// Test 2: Attempt to create a POA with priority bands that do
// not match the resources (i.e., endpoints/lanes). Should get
@@ -525,12 +507,7 @@ main (int argc, char *argv[])
poa_manager->activate (ACE_TRY_ENV);
ACE_TRY_CHECK;
- // Start ORB event loop.
- // @@ Currently we are using Reactor per priority to emulate
- // threadpool with lanes. Once POA threadpools are implemented,
- // this code should be replaced with standard threadpool apis.
- TAO_Pool_Per_Endpoint pool (orb.in ());
- pool.run (ACE_TRY_ENV);
+ orb->run (ACE_TRY_ENV);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG, "\nServer ORB event loop finished\n\n"));
@@ -545,4 +522,3 @@ main (int argc, char *argv[])
return 0;
}
-