summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-21 00:55:36 +0000
committerjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-21 00:55:36 +0000
commit361bd459b98dcf0fee4dd6832d4b944eb0989ecf (patch)
tree55c1e69c6afe8d3aced1ab03c0bd78fe93cc0010
parent780abce30d075273ef6bf62664196694f41c724c (diff)
downloadATCD-361bd459b98dcf0fee4dd6832d4b944eb0989ecf.tar.gz
adding DS library
-rw-r--r--TAO/tao/DiffServPolicy/Client_Network_Priority_Policy.h2
-rw-r--r--TAO/tao/DiffServPolicy/DiffServPolicy_Factory.cpp68
-rw-r--r--TAO/tao/DiffServPolicy/DiffServPolicy_Factory.h2
-rw-r--r--TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp323
-rw-r--r--TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h113
-rw-r--r--TAO/tao/DiffServPolicy/Server_Network_Priority_Policy.h2
6 files changed, 384 insertions, 126 deletions
diff --git a/TAO/tao/DiffServPolicy/Client_Network_Priority_Policy.h b/TAO/tao/DiffServPolicy/Client_Network_Priority_Policy.h
index 4abf564c00e..1746eb8759a 100644
--- a/TAO/tao/DiffServPolicy/Client_Network_Priority_Policy.h
+++ b/TAO/tao/DiffServPolicy/Client_Network_Priority_Policy.h
@@ -43,7 +43,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
* This policy is used to control the network priority assigned to the
* requests and replies, processed by the ORB.
*/
-class TAO_Export TAO_Client_Network_Priority_Policy
+class TAO_DiffServPolicy_Export TAO_Client_Network_Priority_Policy
: public TAO::NetworkPriorityPolicy,
public TAO_Local_RefCounted_Object
{
diff --git a/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.cpp b/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.cpp
index cd80662c192..3f5f8d050f9 100644
--- a/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.cpp
+++ b/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.cpp
@@ -1,56 +1,38 @@
-#include "tao/RTCORBA/RT_PolicyFactory.h"
+#include "tao/DiffServPolicy/DiffServPolicy_Factory.h"
-#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
-
-ACE_RCSID (RTCORBA,
- RT_PolicyFactory,
+ACE_RCSID (DiffServPolicy,
+ DiffServPolicy_Factory,
"$Id$")
-#include "tao/RTCORBA/RT_Policy_i.h"
-
+#include "tao/DiffServPolicy/Client_Network_Priority_Policy.h"
+#include "tao/DiffServPolicy/Server_Network_Priority_Policy.h"
#include "tao/PolicyC.h"
#include "tao/ORB_Constants.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
CORBA::Policy_ptr
-TAO_RT_PolicyFactory::create_policy (
+TAO_DiffServ_PolicyFactory::create_policy (
CORBA::PolicyType type,
const CORBA::Any &value
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
CORBA::PolicyError))
{
- if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
- return TAO_PriorityModelPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
-
- if (type == RTCORBA::THREADPOOL_POLICY_TYPE)
- return TAO_ThreadpoolPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
-
- if (type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
- return TAO_ServerProtocolPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
-
- if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
- return TAO_ClientProtocolPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
+ if (type == TAO::CLIENT_NETWORK_PRIORITY_TYPE)
+ return TAO_Client_Network_Priority_Policy::create (value
+ ACE_ENV_ARG_PARAMETER);
- if (type == RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE)
- return TAO_PrivateConnectionPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
-
- if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
- return TAO_PriorityBandedConnectionPolicy::create (value
- ACE_ENV_ARG_PARAMETER);
+ if (type == TAO::NETWORK_PRIORITY_TYPE)
+ return TAO_Server_Network_Priority_Policy::create (value
+ ACE_ENV_ARG_PARAMETER);
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
CORBA::Policy::_nil ());
}
CORBA::Policy_ptr
-TAO_RT_PolicyFactory::_create_policy (
+TAO_DiffServ_PolicyFactory::_create_policy (
CORBA::PolicyType type
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -58,10 +40,10 @@ TAO_RT_PolicyFactory::_create_policy (
{
CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
- if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ if (type == TAO::CLIENT_NETWORK_PRIORITY_TYPE)
{
ACE_NEW_THROW_EX (policy,
- TAO_PriorityModelPolicy,
+ TAO_Client_Network_Priority_Policy (),
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
@@ -72,24 +54,10 @@ TAO_RT_PolicyFactory::_create_policy (
return policy;
}
- if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ if (type == TAO::NETWORK_PRIORITY_TYPE)
{
ACE_NEW_THROW_EX (policy,
- TAO_PriorityBandedConnectionPolicy,
- CORBA::NO_MEMORY (
- CORBA::SystemException::_tao_minor_code (
- TAO::VMCID,
- ENOMEM),
- CORBA::COMPLETED_NO));
- ACE_CHECK_RETURN (CORBA::Policy::_nil ());
-
- return policy;
- }
-
- if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
- {
- ACE_NEW_THROW_EX (policy,
- TAO_ClientProtocolPolicy,
+ TAO_Server_Network_Priority_Policy (),
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
@@ -105,5 +73,3 @@ TAO_RT_PolicyFactory::_create_policy (
}
TAO_END_VERSIONED_NAMESPACE_DECL
-
-#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.h b/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.h
index 201e396ae88..f516fe5e819 100644
--- a/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.h
+++ b/TAO/tao/DiffServPolicy/DiffServPolicy_Factory.h
@@ -37,7 +37,7 @@
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/// Policy factory for all DiffServ related policies.
-class TAO_DiffServ_PolicyFactory
+class TAO_DiffServPolicy_Export TAO_DiffServ_PolicyFactory
: public virtual PortableInterceptor::PolicyFactory,
public virtual TAO_Local_RefCounted_Object
{
diff --git a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp
index f21ae48ee30..464c35660aa 100644
--- a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp
+++ b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp
@@ -1,85 +1,312 @@
-// $Id$
+#include "tao/RTCORBA/RT_ORBInitializer.h"
-#include "tao/DiffServPolicy/EndpointPolicy_ORBInitializer.h"
-#include "tao/DiffServPolicy/EndpointPolicyC.h"
-#include "tao/DiffServPolicy/EndpointPolicy_Factory.h"
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTCORBA,
+ RT_ORBInitializer,
+ "$Id$")
+
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/RT_PolicyFactory.h"
+#include "tao/RTCORBA/RT_Protocols_Hooks.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/RT_ORB_Loader.h"
+#include "tao/RTCORBA/RT_Stub_Factory.h"
+#include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h"
+#include "tao/RTCORBA/Continuous_Priority_Mapping.h"
+#include "tao/RTCORBA/Linear_Priority_Mapping.h"
+#include "tao/RTCORBA/Direct_Priority_Mapping.h"
+#include "tao/RTCORBA/Linear_Network_Priority_Mapping.h"
+#include "tao/RTCORBA/RT_ORB.h"
+#include "tao/RTCORBA/RT_Current.h"
+#include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h"
+
+#include "tao/Exception.h"
#include "tao/ORB_Core.h"
#include "tao/PI/ORBInitInfo.h"
+#include "tao/debug.h"
-ACE_RCSID (EndpointPolicy,
- EndpointPolicy_ORBInitializer,
- "$Id$")
+#include "ace/Service_Repository.h"
+#include "ace/Svc_Conf.h"
+#include "ace/Sched_Params.h"
+
+static const char rt_poa_factory_name[] = "TAO_RT_Object_Adapter_Factory";
+static const ACE_TCHAR rt_poa_factory_directive[] =
+ ACE_DYNAMIC_SERVICE_DIRECTIVE(
+ "TAO_RT_Object_Adapter_Factory",
+ "TAO_RTPortableServer",
+ "_make_TAO_RT_Object_Adapter_Factory",
+ "");
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (int priority_mapping_type,
+ int network_priority_mapping_type,
+ int ace_sched_policy,
+ long sched_policy,
+ long scope_policy,
+ ACE_Time_Value const &dynamic_thread_idle_timeout)
+ : priority_mapping_type_ (priority_mapping_type),
+ network_priority_mapping_type_ (network_priority_mapping_type),
+ ace_sched_policy_ (ace_sched_policy),
+ sched_policy_ (sched_policy),
+ scope_policy_ (scope_policy),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout)
+{
+}
+
void
-TAO_EndpointPolicy_ORBInitializer::pre_init (
- PortableInterceptor::ORBInitInfo_ptr
- ACE_ENV_ARG_DECL_NOT_USED)
+TAO_RT_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ //
+ // Register all of the RT related services.
+ //
+
+ // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks.
+ TAO_ORB_Core::set_protocols_hooks ("RT_Protocols_Hooks");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks);
+
+ // Set the name of the stub factory to be RT_Stub_Factory.
+ TAO_ORB_Core::set_stub_factory ("RT_Stub_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Stub_Factory);
+
+ // Set the name of the stub factory to be RT_Stub_Factory.
+ TAO_ORB_Core::set_endpoint_selector_factory ("RT_Endpoint_Selector_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_RT_Endpoint_Selector_Factory);
+
+ // Set the name of the thread lane resources manager to be RT_Thread_Lane_Resources_Manager.
+ TAO_ORB_Core::set_thread_lane_resources_manager_factory ("RT_Thread_Lane_Resources_Manager_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Thread_Lane_Resources_Manager_Factory);
+
+ // If the application resolves the root POA, make sure we load the RT POA.
+ TAO_ORB_Core::set_poa_factory (rt_poa_factory_name,
+ ACE_TEXT_ALWAYS_CHAR (rt_poa_factory_directive));
+
+ // Create the initial priority mapping instance.
+ TAO_Priority_Mapping *pm = 0;
+ switch (this->priority_mapping_type_)
+ {
+ case TAO_PRIORITY_MAPPING_CONTINUOUS:
+ ACE_NEW (pm,
+ TAO_Continuous_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ case TAO_PRIORITY_MAPPING_LINEAR:
+ ACE_NEW (pm,
+ TAO_Linear_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ default:
+ case TAO_PRIORITY_MAPPING_DIRECT:
+ ACE_NEW (pm,
+ TAO_Direct_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ }
+
+ // Set the Priority_Mapping_Manager
+ TAO_Priority_Mapping_Manager *manager = 0;
+
+ ACE_NEW_THROW_EX (manager,
+ TAO_Priority_Mapping_Manager (pm),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Priority_Mapping_Manager_var safe_manager = manager;
+
+ info->register_initial_reference ("PriorityMappingManager",
+ manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the initial priority mapping instance.
+ TAO_Network_Priority_Mapping *npm = 0;
+ switch (this->network_priority_mapping_type_)
+ {
+ default:
+ case TAO_NETWORK_PRIORITY_MAPPING_LINEAR:
+ ACE_NEW (npm,
+ TAO_Linear_Network_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ }
+
+ // Set the Priority_Mapping_Manager
+ TAO_Network_Priority_Mapping_Manager * network_manager = 0;
+
+ // @@ There is a potential memory leak here. If the new() below
+ // throws an exception, the memory for the network priority
+ // mapping allocated above will be leaked. Use an auto_ptr<> or
+ // the appropriate memory management tool.
+
+ ACE_NEW_THROW_EX (network_manager,
+ TAO_Network_Priority_Mapping_Manager (npm),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Network_Priority_Mapping_Manager_var safe_network_manager =
+ network_manager;
+
+ info->register_initial_reference ("NetworkPriorityMappingManager",
+ network_manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+ TAO_ORBInitInfo_var tao_info =
+ TAO_ORBInitInfo::_narrow (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n"
+ "(%P|%t) Unable to narrow "
+ "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
+ "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Create the RT_ORB.
+ CORBA::Object_ptr rt_orb = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (rt_orb,
+ TAO_RT_ORB (tao_info->orb_core (),
+ dynamic_thread_idle_timeout_),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ CORBA::Object_var safe_rt_orb = rt_orb;
+
+ info->register_initial_reference (TAO_OBJID_RTORB,
+ rt_orb
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the RT_Current.
+ CORBA::Object_ptr current = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (current,
+ TAO_RT_Current (tao_info->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ CORBA::Object_var safe_rt_current = current;
+
+ info->register_initial_reference (TAO_OBJID_RTCURRENT,
+ current
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ tao_info->orb_core ()->orb_params ()->scope_policy (this->scope_policy_);
+ tao_info->orb_core ()->orb_params ()->sched_policy (this->sched_policy_);
+ tao_info->orb_core ()->orb_params ()->ace_sched_policy (this->ace_sched_policy_);
}
void
-TAO_EndpointPolicy_ORBInitializer::post_init (
+TAO_RT_ORBInitializer::post_init (
PortableInterceptor::ORBInitInfo_ptr info
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
this->register_policy_factories (info
ACE_ENV_ARG_PARAMETER);
+
ACE_CHECK;
}
void
-TAO_EndpointPolicy_ORBInitializer::register_policy_factories (
+TAO_RT_ORBInitializer::register_policy_factories (
PortableInterceptor::ORBInitInfo_ptr info
ACE_ENV_ARG_DECL)
{
- TAO_ORBInitInfo * local_info = dynamic_cast <TAO_ORBInitInfo *> (info);
- TAO_ORB_Core * the_orb_core = local_info->orb_core ();
+ // The RTCorba policy factory is stateless and reentrant, so share a
+ // single instance between all ORBs.
+ if (CORBA::is_nil (this->policy_factory_.in ()))
+ {
+ PortableInterceptor::PolicyFactory_ptr policy_factory;
+ ACE_NEW_THROW_EX (policy_factory,
+ TAO_RT_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
- // Register the EndpointPolicy policy factories.
- PortableInterceptor::PolicyFactory_ptr policy_factory_ptr;
- ACE_NEW_THROW_EX (policy_factory_ptr,
- TAO_EndpointPolicy_Factory(the_orb_core),
- CORBA::NO_MEMORY (
- CORBA::SystemException::_tao_minor_code (
- TAO::VMCID,
- ENOMEM),
- CORBA::COMPLETED_NO));
- ACE_CHECK;
+ this->policy_factory_ = policy_factory;
+ }
+ // Bind the same policy factory to all RTCORBA related policy
+ // types since a single policy factory is used to create each of
+ // the different types of RTCORBA policies.
+ static CORBA::PolicyType const type[] = {
+ RTCORBA::PRIORITY_MODEL_POLICY_TYPE,
+ RTCORBA::THREADPOOL_POLICY_TYPE,
+ RTCORBA::SERVER_PROTOCOL_POLICY_TYPE,
+ RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE,
+ RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE,
+ RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE
+ };
- PortableInterceptor::PolicyFactory_var policy_factory =
- policy_factory_ptr;
+ const CORBA::PolicyType *end =
+ type + sizeof (type) / sizeof (type[0]);
- ACE_TRY
- {
- info->register_policy_factory (EndpointPolicy::ENDPOINT_POLICY_TYPE,
- policy_factory.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ for (CORBA::PolicyType const * i = type;
+ i != end;
+ ++i)
{
- if (ex.minor () == (CORBA::OMGVMCID | 16))
+ ACE_TRY
{
- // The factory is already there, it happens because the
- // magic initializer in Messaging.cpp registers with the
- // ORB multiple times. This is an indication that we
- // should do no more work in this ORBInitializer.
- return;
+ info->register_policy_factory (*i,
+ this->policy_factory_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
}
- ACE_RE_THROW;
- }
- ACE_CATCHANY
- {
- // Rethrow any other exceptions...
- ACE_RE_THROW;
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in PortableServer.cpp registers
+ // with the ORB multiple times. This is an indication
+ // that we should do no more work in this
+ // ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
}
- ACE_ENDTRY;
- ACE_CHECK;
}
TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h
index 26ae4346612..c2f04c46c04 100644
--- a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h
+++ b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h
@@ -2,27 +2,31 @@
//=============================================================================
/**
- * @file DiffServPolicy_ORBInitializer.h
+ * @file RT_ORBInitializer.h
*
* $Id$
*
- * @author Jaiganesh Balasubramanian <jai@dre.vanderbilt.edu>
- * Johnny Willemsen <jwillemsen@remedy.nl>
+ * @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
-#ifndef TAO_DIFFSERVPOLICY_ORB_INITIALIZER_H
-#define TAO_DIFFSERVPOLICY_ORB_INITIALIZER_H
+#ifndef TAO_RT_ORB_INITIALIZER_H
+#define TAO_RT_ORB_INITIALIZER_H
#include /**/ "ace/pre.h"
-#include "tao/DiffServPolicy/DiffServPolicy_Export.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+
#include "tao/PI/PI.h"
#include "tao/LocalObject.h"
@@ -35,20 +39,31 @@
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
-/// DiffServPolicy ORB initializer.
-class TAO_DiffServPolicy_ORBInitializer
- : public virtual PortableInterceptor::ORBInitializer,
- public virtual TAO_Local_RefCounted_Object
+/// RTCORBA ORB initializer.
+class TAO_RT_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer
+ , public virtual TAO_Local_RefCounted_Object
{
public:
-
- /**
- * @name PortableInterceptor::ORBInitializer Methods
- *
- * The following methods are required by the
- * PortableInterceptor::ORBInitializer interface.
- */
- //@{
+ /// Priority mapping types
+ enum
+ {
+ TAO_PRIORITY_MAPPING_CONTINUOUS,
+ TAO_PRIORITY_MAPPING_LINEAR,
+ TAO_PRIORITY_MAPPING_DIRECT
+ };
+
+ enum
+ {
+ TAO_NETWORK_PRIORITY_MAPPING_LINEAR
+ };
+
+ TAO_RT_ORBInitializer (int priority_mapping_type,
+ int network_priority_mapping_type,
+ int ace_sched_policy,
+ long sched_policy,
+ long scope_policy,
+ ACE_Time_Value const &dynamic_thread_idle_timeout);
virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
@@ -58,15 +73,63 @@ public:
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
- //@}
-
private:
- /// Register DiffServ policy factories.
+ /// Register RTCORBA policy factories.
void register_policy_factories (
- PortableInterceptor::ORBInitInfo_ptr info
- ACE_ENV_ARG_DECL);
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+private:
+ /// Instance of the RTCorba policy factory.
+ /**
+ * The RTCorba policy factory is stateless and reentrant, so share
+ * a single instance between all ORBs.
+ */
+ PortableInterceptor::PolicyFactory_var policy_factory_;
+
+ /// Priority mapping type.
+ int const priority_mapping_type_;
+
+ /// Network Priority mapping type.
+ int const network_priority_mapping_type_;
+ /// Scheduling policy.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by
+ * functions like ACE_OS::thr_setprio() and
+ * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
+ * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
+ */
+ int const ace_sched_policy_;
+
+ /// Scheduling policy flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCHED_RR,
+ * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
+ */
+ long const sched_policy_;
+
+ /// Scheduling scope flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBScopePolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
+ * THR_SCOPE_PROCESS.
+ */
+ long const scope_policy_;
+
+ /// Dynamic thread idle timeout
+ /**
+ * When using thread pool a certain number of dynamic threads can be created.
+ * By default these threads are created when needed but never end, when this
+ * timeout is specified the threads end themselves at the moment they
+ * have not been serving any requests for the specified amount of time
+ */
+ ACE_Time_Value const dynamic_thread_idle_timeout_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
@@ -75,6 +138,8 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#pragma warning(pop)
#endif /* _MSC_VER */
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
#include /**/ "ace/post.h"
-#endif /* TAO_DIFFSERVPOLICY_ORB_INITIALIZER_H */
+#endif /* TAO_RT_ORB_INITIALIZER_H */
diff --git a/TAO/tao/DiffServPolicy/Server_Network_Priority_Policy.h b/TAO/tao/DiffServPolicy/Server_Network_Priority_Policy.h
index 23d0694944f..e822ee74dbe 100644
--- a/TAO/tao/DiffServPolicy/Server_Network_Priority_Policy.h
+++ b/TAO/tao/DiffServPolicy/Server_Network_Priority_Policy.h
@@ -43,7 +43,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
* This policy is used to control the network priority assigned to the
* requests and replies, processed by the ORB.
*/
-class TAO_Export TAO_Server_Network_Priority_Policy
+class TAO_DiffServPolicy_Export TAO_Server_Network_Priority_Policy
: public TAO::NetworkPriorityPolicy,
public TAO_Local_RefCounted_Object
{