summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-06-29 08:16:59 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-06-29 08:16:59 +0000
commitd2a4f6058da3b8f4c3fbbdc35dbbd13478a695e3 (patch)
tree2dd6f8a18d72d158a624411bb702632815f68bff
parente6ae7076d1e40e38cd8a0ac981752d3e8db3aa3e (diff)
downloadATCD-d2a4f6058da3b8f4c3fbbdc35dbbd13478a695e3.tar.gz
ChangeLogTag: Fri Jun 29 03:14:14 2001 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a39
-rw-r--r--TAO/tao/ORB_Core.cpp32
-rw-r--r--TAO/tao/ORB_Core.h29
-rw-r--r--TAO/tao/RTCORBA/RT_ORB.cpp63
-rw-r--r--TAO/tao/Strategies/Reactor_Per_Priority.cpp33
5 files changed, 167 insertions, 29 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index db43e3b90c6..e9997594499 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,42 @@
+Fri Jun 29 03:14:14 2001 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * tao/Strategies/Reactor_Per_Priority.cpp (reactor): Changed to
+ use the new CORBA_Priority_Normalizer class.
+
+ * tao/RTCORBA/RT_ORB.cpp (class TAO_RT_CORBA_Priority_Normalizer):
+ Added new class. The class does the correct corba priority
+ normalization when RT CORBA is used.
+
+ * tao/ORB_Core (TAO_CORBA_Priority_Normalizer): Added new class
+ TAO_CORBA_Priority_Normalizer. This class is an abstract class
+ used to prevent dependencies between the Strategies and the
+ RTCORBA library.
+
+Thu Jun 28 23:49:13 2001 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * tao/RTCORBA/Linear_Priority_Mapping.cpp (TAO_Linear_Priority_Mapping):
+ * tao/RTCORBA/Direct_Priority_Mapping.cpp (TAO_Direct_Priority_Mapping):
+
+ We have special behavior for SUNs. This is because the results
+ from ACE_Sched_Params::priority_min() and
+ ACE_Sched_Params::priority_max() are not correct.
+
+ * tao/Strategies/Reactor_Per_Priority.cpp (reactor): We need to
+ "normalize" the corba priority of the endpoint. Here is the
+ explanation for going from CORBA priority to Native
+ and back again:
+
+ Suppose the user specifies 20,000 as the (CORBA) priority for a
+ endpoint. 20,000 will be mapped to the native priority (say 10)
+ when the thread is created. When the thread goes to access it's
+ reactor, the native priority will be converted to the CORBA
+ priority (say 19,000) which is used to look up the reactor.
+ There is a loss of precision in this conversion.
+
+ We use the same two step normalization here. Otherwise, we'll
+ get a reactor which is different than the one used by the
+ endpoint thread(s).
+
Thu Jun 28 18:56:17 2001 Jeff Parsons <parsons@cs.wustl.edu>
* orbsvcs/IFR_Service/Container_i.cpp:
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index c680d09177a..892b7a4fce3 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -175,7 +175,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid)
transport_cache_ (0),
bidir_adapter_ (0),
bidir_giop_policy_ (0),
- flushing_strategy_ (0)
+ flushing_strategy_ (0),
+ corba_priority_normalizer_ (0)
{
#if defined(ACE_MVS)
ACE_NEW (this->from_iso8859_, ACE_IBM1047_ISO8859);
@@ -208,6 +209,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid)
ACE_NEW (this->transport_sync_strategy_,
TAO_Transport_Sync_Strategy);
+ ACE_NEW (this->corba_priority_normalizer_,
+ TAO_CORBA_Priority_Normalizer);
}
TAO_ORB_Core::~TAO_ORB_Core (void)
@@ -238,6 +241,8 @@ TAO_ORB_Core::~TAO_ORB_Core (void)
delete this->transport_sync_strategy_;
delete this->poa_extension_initializer_;
+
+ delete this->corba_priority_normalizer_;
}
#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
@@ -1241,6 +1246,31 @@ TAO_ORB_Core::fini (void)
return 0;
}
+TAO_CORBA_Priority_Normalizer::~TAO_CORBA_Priority_Normalizer (void)
+{
+}
+
+CORBA::Boolean
+TAO_CORBA_Priority_Normalizer::normalize (CORBA::Short corba_priority,
+ CORBA::Short &normalized_corba_priority)
+{
+ normalized_corba_priority = corba_priority;
+ return 1;
+}
+
+TAO_CORBA_Priority_Normalizer *
+TAO_ORB_Core::corba_priority_normalizer (void) const
+{
+ return this->corba_priority_normalizer_;
+}
+
+void
+TAO_ORB_Core::corba_priority_normalizer (TAO_CORBA_Priority_Normalizer *new_normalizer)
+{
+ delete this->corba_priority_normalizer_;
+ this->corba_priority_normalizer_ = new_normalizer;
+}
+
void
TAO_ORB_Core::set_stub_factory(const char *stub_factory_name)
{
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index 0ff9e111629..09e78ba2d3b 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -174,6 +174,25 @@ public:
// ****************************************************************
/**
+ * @class TAO_CORBA_Priority_Normalizer
+ *
+ * @brief Used to keep Strategy library separate from the RT library.
+ **/
+class TAO_Export TAO_CORBA_Priority_Normalizer
+{
+public:
+
+ /// Virtual destructor
+ virtual ~TAO_CORBA_Priority_Normalizer (void);
+
+ /// Normalize CORBA Priority
+ virtual CORBA::Boolean normalize (CORBA::Short corba_priority,
+ CORBA::Short &normalized_corba_priority);
+};
+
+// ****************************************************************
+
+/**
* @class TAO_ORB_Core
*
* @brief Encapsulates the state of an ORB.
@@ -261,6 +280,13 @@ public:
/// Get the POA extension initializers.
TAO_POA_Extension_Initializer *poa_extension_initializer (void);
+ /// Get the priority normalizer.
+ TAO_CORBA_Priority_Normalizer *corba_priority_normalizer (void) const;
+
+ /// Set the priority normalizer. Takes over the memory management
+ //of <new_normalizer>: <new_normalizer> will be deleted.
+ void corba_priority_normalizer (TAO_CORBA_Priority_Normalizer *new_normalizer);
+
/// @name Collocation Strategies
//@{
enum
@@ -1251,6 +1277,9 @@ protected:
/// Hold the flushing strategy
TAO_Flushing_Strategy *flushing_strategy_;
+
+ /// CORBA Priority Normalizer.
+ TAO_CORBA_Priority_Normalizer *corba_priority_normalizer_;
};
// ****************************************************************
diff --git a/TAO/tao/RTCORBA/RT_ORB.cpp b/TAO/tao/RTCORBA/RT_ORB.cpp
index 80cdfd9b045..c4505b74963 100644
--- a/TAO/tao/RTCORBA/RT_ORB.cpp
+++ b/TAO/tao/RTCORBA/RT_ORB.cpp
@@ -3,6 +3,8 @@
#include "RT_ORB.h"
#include "RT_Policy_i.h"
#include "RT_Mutex.h"
+#include "Priority_Mapping_Manager.h"
+#include "tao/ORB_Core.h"
#if ! defined (__ACE_INLINE__)
#include "RT_ORB.i"
@@ -10,11 +12,71 @@
ACE_RCSID(TAO, RT_ORB, "$Id$")
+class TAO_RT_CORBA_Priority_Normalizer : public TAO_CORBA_Priority_Normalizer
+{
+public:
+ /// Constructor.
+ TAO_RT_CORBA_Priority_Normalizer (TAO_ORB_Core *orb_core);
+
+ /// Normalize CORBA Priority
+ CORBA::Boolean normalize (CORBA::Short corba_priority,
+ CORBA::Short &normalized_corba_priority);
+
+private:
+ // Reference to the priority mapping.
+ RTCORBA::PriorityMapping *priority_mapping_;
+};
+
+TAO_RT_CORBA_Priority_Normalizer::TAO_RT_CORBA_Priority_Normalizer (TAO_ORB_Core *orb_core)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ // Save a reference to the priority mapping manager.
+ CORBA::Object_var obj =
+ orb_core->object_ref_table ().resolve_initial_references (
+ TAO_OBJID_PRIORITYMAPPINGMANAGER,
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ TAO_Priority_Mapping_Manager_var mapping_manager =
+ TAO_Priority_Mapping_Manager::_narrow (obj.in (),
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ this->priority_mapping_ =
+ mapping_manager->mapping ();
+}
+
+CORBA::Boolean
+TAO_RT_CORBA_Priority_Normalizer::normalize (CORBA::Short corba_priority,
+ CORBA::Short &normalized_corba_priority)
+{
+ CORBA::Short native_priority;
+
+ CORBA::Boolean result =
+ this->priority_mapping_->to_native (corba_priority,
+ native_priority);
+ if (result == 0)
+ return 0;
+
+ result =
+ this->priority_mapping_->to_CORBA (native_priority,
+ normalized_corba_priority);
+ if (result == 0)
+ return 0;
+
+ return 1;
+}
+
TAO_RT_ORB::TAO_RT_ORB (CORBA::ORB_ptr orb)
: orb_ (CORBA::ORB::_duplicate (orb)),
mutex_mgr_ (),
tp_manager_ (orb)
{
+ TAO_RT_CORBA_Priority_Normalizer *corba_priority_normalizer = 0;
+ ACE_NEW (corba_priority_normalizer,
+ TAO_RT_CORBA_Priority_Normalizer (orb->orb_core ()));
+ orb->orb_core ()->corba_priority_normalizer (corba_priority_normalizer);
}
TAO_RT_ORB::~TAO_RT_ORB (void)
@@ -404,4 +466,3 @@ template class ACE_Hash_Map_Entry<ACE_CString, RTCORBA::Mutex_var>;
#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
diff --git a/TAO/tao/Strategies/Reactor_Per_Priority.cpp b/TAO/tao/Strategies/Reactor_Per_Priority.cpp
index 453f0750a8a..c94fd71c315 100644
--- a/TAO/tao/Strategies/Reactor_Per_Priority.cpp
+++ b/TAO/tao/Strategies/Reactor_Per_Priority.cpp
@@ -78,37 +78,16 @@ TAO_Reactor_Per_Priority::reactor (TAO_Acceptor *acceptor)
// get a reactor which is different than the one used by the
// endpoint thread(s).
- ACE_DECLARE_NEW_CORBA_ENV;
-
+ CORBA::Short normalized_corba_priority = 0;
CORBA::Short user_specified_corba_priority =
acceptor->priority ();
- CORBA::Object_var obj =
- this->orb_core ()->priority_mapping_manager ();
-
- TAO_Priority_Mapping_Manager_var mapping_manager =
- TAO_Priority_Mapping_Manager::_narrow (obj.in (),
- ACE_TRY_ENV);
- ACE_CHECK_RETURN (0);
-
- TAO_Priority_Mapping *priority_mapping =
- mapping_manager.in ()->mapping ();
-
- CORBA::Short native_priority;
-
- int result =
- priority_mapping->to_native (user_specified_corba_priority,
- native_priority);
-
- if (result == 0)
- return 0;
-
- CORBA::Short normalized_corba_priority;
-
- result =
- priority_mapping->to_CORBA (native_priority,
- normalized_corba_priority);
+ TAO_CORBA_Priority_Normalizer *corba_priority_normalizer =
+ this->orb_core ()->corba_priority_normalizer ();
+ CORBA::Boolean result =
+ corba_priority_normalizer->normalize (user_specified_corba_priority,
+ normalized_corba_priority);
if (result == 0)
return 0;