summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-07-08 17:01:38 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-07-08 17:01:38 +0000
commit304706df1ef2600a9713122b030305fee07b945a (patch)
tree2ab631d155c7ad8c42e06565c0ce8fd200531042 /TAO/tao
parent35303ce4d93f4afceef5acf0b8952132c23889db (diff)
downloadATCD-304706df1ef2600a9713122b030305fee07b945a.tar.gz
ChangeLogTag: Sun Jun 30 22:22:05 2002 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Default_Endpoint_Selector_Factory.cpp3
-rw-r--r--TAO/tao/Default_Protocols_Hooks.cpp2
-rw-r--r--TAO/tao/Default_Protocols_Hooks.h2
-rw-r--r--TAO/tao/GIOP_Message_Base.cpp6
-rw-r--r--TAO/tao/GIOP_Message_Base.h3
-rw-r--r--TAO/tao/GIOP_Message_Lite.cpp6
-rw-r--r--TAO/tao/GIOP_Message_Lite.h59
-rw-r--r--TAO/tao/IIOP_Endpoint.cpp13
-rw-r--r--TAO/tao/IIOP_Endpoint.h3
-rw-r--r--TAO/tao/IIOP_Endpoint.i31
-rw-r--r--TAO/tao/Invocation_Endpoint_Selectors.cpp11
-rw-r--r--TAO/tao/Invocation_Endpoint_Selectors.h19
-rw-r--r--TAO/tao/ORB_Core.cpp8
-rw-r--r--TAO/tao/Pluggable_Messaging.h19
-rw-r--r--TAO/tao/Protocols_Hooks.h2
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp156
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h54
-rw-r--r--TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp690
-rw-r--r--TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h147
-rw-r--r--TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.i33
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp9
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.h11
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.cpp9
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.h3
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.i31
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.cpp6
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.h3
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.i31
-rw-r--r--TAO/tao/Transport.cpp13
-rw-r--r--TAO/tao/params.cpp3
-rw-r--r--TAO/tao/params.h7
-rw-r--r--TAO/tao/params.i12
32 files changed, 449 insertions, 956 deletions
diff --git a/TAO/tao/Default_Endpoint_Selector_Factory.cpp b/TAO/tao/Default_Endpoint_Selector_Factory.cpp
index 3a086060af3..efe9300f4ba 100644
--- a/TAO/tao/Default_Endpoint_Selector_Factory.cpp
+++ b/TAO/tao/Default_Endpoint_Selector_Factory.cpp
@@ -24,7 +24,7 @@ TAO_Default_Endpoint_Selector_Factory::~TAO_Default_Endpoint_Selector_Factory (v
TAO_Invocation_Endpoint_Selector *
TAO_Default_Endpoint_Selector_Factory::get_selector (TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_ENV_ARG_DECL_NOT_USED)
{
// Trivial endpoint selector. Just return the default selector.
return this->default_endpoint_selector_;
@@ -39,4 +39,3 @@ ACE_STATIC_SVC_DEFINE (TAO_Default_Endpoint_Selector_Factory,
ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
0)
ACE_FACTORY_DEFINE (TAO, TAO_Default_Endpoint_Selector_Factory)
-
diff --git a/TAO/tao/Default_Protocols_Hooks.cpp b/TAO/tao/Default_Protocols_Hooks.cpp
index 2abb615e29a..0ef3d79a2e6 100644
--- a/TAO/tao/Default_Protocols_Hooks.cpp
+++ b/TAO/tao/Default_Protocols_Hooks.cpp
@@ -58,7 +58,7 @@ TAO_Default_Protocols_Hooks::get_selector_hook (CORBA::Policy *,
void
TAO_Default_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *,
- CORBA::Short &,
+ CORBA::Short,
CORBA::Short &,
CORBA::Short &,
int &)
diff --git a/TAO/tao/Default_Protocols_Hooks.h b/TAO/tao/Default_Protocols_Hooks.h
index 178777669e5..a215671c425 100644
--- a/TAO/tao/Default_Protocols_Hooks.h
+++ b/TAO/tao/Default_Protocols_Hooks.h
@@ -58,9 +58,9 @@ public:
CORBA::Short &server_priority);
virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short p,
CORBA::Short &min_priority,
CORBA::Short &max_priority,
- CORBA::Short &p,
int &in_range);
virtual int get_thread_CORBA_priority (CORBA::Short &
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp
index 1c65d8618b9..7e89fce4ba5 100644
--- a/TAO/tao/GIOP_Message_Base.cpp
+++ b/TAO/tao/GIOP_Message_Base.cpp
@@ -1532,3 +1532,9 @@ TAO_GIOP_Message_Base::make_queued_data (size_t sz)
return qd;
}
+
+size_t
+TAO_GIOP_Message_Base::header_length (void) const
+{
+ return TAO_GIOP_MESSAGE_HEADER_LEN;
+}
diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h
index 44b0feeefba..1ed66ef6b70 100644
--- a/TAO/tao/GIOP_Message_Base.h
+++ b/TAO/tao/GIOP_Message_Base.h
@@ -139,6 +139,9 @@ public:
CORBA::Exception &x
);
+ /// Header length
+ virtual size_t header_length (void) const;
+
protected:
/// Processes the <GIOP_REQUEST> messages
diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp
index 14747f1d897..6395e1afa27 100644
--- a/TAO/tao/GIOP_Message_Lite.cpp
+++ b/TAO/tao/GIOP_Message_Lite.cpp
@@ -1643,3 +1643,9 @@ TAO_GIOP_Message_Lite::is_ready_for_bidirectional (TAO_OutputCDR & )
// No we dont support..
return 0;
}
+
+size_t
+TAO_GIOP_Message_Lite::header_length (void) const
+{
+ return TAO_GIOP_LITE_HEADER_LEN;
+}
diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h
index e13a8078b4e..afe78e63136 100644
--- a/TAO/tao/GIOP_Message_Lite.h
+++ b/TAO/tao/GIOP_Message_Lite.h
@@ -45,7 +45,7 @@ public:
/// Constructor
TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core,
- size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
+ size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
/// Dtor
virtual ~TAO_GIOP_Message_Lite (void);
@@ -59,8 +59,8 @@ public:
/// Write the RequestHeader in to the <cdr> stream. The underlying
/// implementation of the mesaging should do the right thing.
virtual int generate_request_header (TAO_Operation_Details &op,
- TAO_Target_Specification &spec,
- TAO_OutputCDR &cdr);
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr);
/// Write the RequestHeader in to the <cdr> stream.
virtual int generate_locate_request_header (
@@ -76,8 +76,8 @@ public:
/// Dummy method to ..
virtual int read_message (TAO_Transport *transport,
- int block = 0,
- ACE_Time_Value *max_wait_time = 0);
+ int block = 0,
+ ACE_Time_Value *max_wait_time = 0);
/// Format the message. As we have not written the message length in
@@ -106,23 +106,23 @@ public:
* 0 if there are no more messages in <incoming>.
*/
virtual int extract_next_message (ACE_Message_Block &incoming,
- TAO_Queued_Data *&qd);
+ TAO_Queued_Data *&qd);
/// Check whether the node <qd> needs consolidation from <incoming>
virtual int consolidate_node (TAO_Queued_Data *qd,
- ACE_Message_Block &incoming);
+ ACE_Message_Block &incoming);
/// Get the details of the message parsed through the <qd>.
virtual void get_message_data (TAO_Queued_Data *qd);
/// @@Bala: Docu???
virtual int consolidate_fragments (TAO_Queued_Data *dqd,
- const TAO_Queued_Data *sqd);
+ const TAO_Queued_Data *sqd);
/// Process the request message that we have received on the
/// connection
virtual int process_request_message (TAO_Transport *transport,
- TAO_Queued_Data *qd);
+ TAO_Queued_Data *qd);
/// Parse the reply message that we received and return the reply
/// information though <reply_info>
@@ -143,47 +143,47 @@ private:
/// NOTE: If the GIOP header happens to change in the future, we can
/// push this method in to the generator_parser classes.
int write_protocol_header (TAO_GIOP_Message_Type t,
- TAO_OutputCDR &msg);
+ TAO_OutputCDR &msg);
/// Processes the <GIOP_REQUEST> messages
int process_request (TAO_Transport *transport,
- TAO_InputCDR &input,
- TAO_OutputCDR &output);
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output);
/// Processes the <GIOP_LOCATE_REQUEST> messages
int process_locate_request (TAO_Transport *transport,
- TAO_InputCDR &input,
- TAO_OutputCDR &output);
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output);
/// Make a <GIOP_LOCATEREPLY> and hand that over to the transport so
/// that it can be sent over the connection.
/// NOTE:As on date 1.1 & 1.2 seem to have similar headers. Till an
/// unmanageable difference comes let them be implemented here.
int make_send_locate_reply (TAO_Transport *transport,
- TAO_OutputCDR &output,
- TAO_GIOP_Locate_Request_Header &request,
- TAO_GIOP_Locate_Status_Msg &status);
+ TAO_OutputCDR &output,
+ TAO_GIOP_Locate_Request_Header &request,
+ TAO_GIOP_Locate_Status_Msg &status);
/// Send error messages
int send_error (TAO_Transport *transport);
/// Close a connection, first sending GIOP::CloseConnection.
void send_close_connection (const TAO_GIOP_Message_Version &version,
- TAO_Transport *transport,
- void *ctx);
+ TAO_Transport *transport,
+ void *ctx);
/// We must send a LocateReply through <transport>, this request
/// resulted in some kind of exception.
int send_reply_exception (TAO_Transport *transport,
- TAO_ORB_Core* orb_core,
- CORBA::ULong request_id,
- IOP::ServiceContextList *svc_info,
- CORBA::Exception *x);
+ TAO_ORB_Core* orb_core,
+ CORBA::ULong request_id,
+ IOP::ServiceContextList *svc_info,
+ CORBA::Exception *x);
/// Print out a debug messages..
void dump_msg (const char *label,
- const u_char *ptr,
- size_t len);
+ const u_char *ptr,
+ size_t len);
TAO_Queued_Data *make_queued_data (size_t sz);
@@ -196,6 +196,9 @@ private:
/// request/response?
virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg);
+ /// Header length
+ virtual size_t header_length (void) const;
+
private:
/// Write the request header in to <msg>
@@ -234,11 +237,11 @@ private:
/// Parse the reply message
int parse_reply (TAO_InputCDR &input,
- TAO_Pluggable_Reply_Params &params);
+ TAO_Pluggable_Reply_Params &params);
/// Parse the locate reply message from the server
int parse_locate_reply (TAO_InputCDR &input,
- TAO_Pluggable_Reply_Params &params);
+ TAO_Pluggable_Reply_Params &params);
private:
@@ -246,7 +249,7 @@ private:
TAO_ORB_Core *orb_core_;
/// The message type that we are going to process..
- CORBA::Octet message_type_;
+ CORBA::Octet message_type_;
/// The pay load size
CORBA::ULong message_size_;
diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp
index 55cc2626a5d..ccb4521349f 100644
--- a/TAO/tao/IIOP_Endpoint.cpp
+++ b/TAO/tao/IIOP_Endpoint.cpp
@@ -17,7 +17,7 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const ACE_INET_Addr &addr,
host_ (),
port_ (683), // default port (IANA assigned)
object_addr_ (addr),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
this->set (addr, use_dotted_decimal_addresses);
@@ -30,13 +30,11 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (addr),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
this->host_ = host;
-
- this->object_addr_.set_type (-1);
}
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (void)
@@ -44,10 +42,9 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (void)
host_ (),
port_ (683), // default port (IANA assigned)
object_addr_ (),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
- this->object_addr_.set_type (-1);
}
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
@@ -57,19 +54,17 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (),
- /* hint_ (0),*/
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
this->host_ = host;
- this->object_addr_.set_type (-1);
this->priority (priority);
}
TAO_IIOP_Endpoint::~TAO_IIOP_Endpoint (void)
{
-
}
int
diff --git a/TAO/tao/IIOP_Endpoint.h b/TAO/tao/IIOP_Endpoint.h
index cd9905d5f46..451ccd78bbf 100644
--- a/TAO/tao/IIOP_Endpoint.h
+++ b/TAO/tao/IIOP_Endpoint.h
@@ -126,6 +126,9 @@ private:
/// invocations, etc.
ACE_INET_Addr object_addr_;
+ /// Flag to indicate if the address has been resolved and set.
+ int object_addr_set_;
+
/// IIOP Endpoints can be stringed into a list. Return the next
/// endpoint in the list, if any.
TAO_IIOP_Endpoint *next_;
diff --git a/TAO/tao/IIOP_Endpoint.i b/TAO/tao/IIOP_Endpoint.i
index 9f408752b4a..ab8738e58d2 100644
--- a/TAO/tao/IIOP_Endpoint.i
+++ b/TAO/tao/IIOP_Endpoint.i
@@ -11,7 +11,7 @@ TAO_IIOP_Endpoint::object_addr (void) const
// ...etc..
// Double checked locking optimization.
- if (this->object_addr_.get_type () != AF_INET)
+ if (!this->object_addr_set_)
{
// We need to modify the object_addr_ in this method. Do so
// using a non-const copy of the <this> pointer.
@@ -23,18 +23,25 @@ TAO_IIOP_Endpoint::object_addr (void) const
endpoint->addr_lookup_lock_,
this->object_addr_ );
- if (this->object_addr_.get_type () != AF_INET
- && endpoint->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
+ if (!this->object_addr_set_)
{
- // If this call fails, it most likely due a hostname lookup
- // failure caused by a DNS misconfiguration. If a request
- // is made to the object at the given host and port, then a
- // CORBA::TRANSIENT() exception should be thrown.
-
- // Invalidate the ACE_INET_Addr. This is used as a flag to
- // denote that ACE_INET_Addr initialization failed.
- endpoint->object_addr_.set_type (-1);
+ if (endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+ else
+ {
+ endpoint->object_addr_set_ = 1;
+ }
}
}
diff --git a/TAO/tao/Invocation_Endpoint_Selectors.cpp b/TAO/tao/Invocation_Endpoint_Selectors.cpp
index 352500faa06..35d0c7a518d 100644
--- a/TAO/tao/Invocation_Endpoint_Selectors.cpp
+++ b/TAO/tao/Invocation_Endpoint_Selectors.cpp
@@ -59,17 +59,6 @@ TAO_Default_Endpoint_Selector::select_endpoint (
CORBA::COMPLETED_NO));
}
-// @@ RTCORBA_Subsetting - next should be deprecated...
-void
-TAO_Default_Endpoint_Selector::next (TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL_NOT_USED)
-{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This method is DEPRECATED!\n")));
- // if (invocation->stub_->next_profile_retry () == 0)
- // ACE_THROW (CORBA::TRANSIENT (TAO_OMG_VMCID | 2,
- // CORBA::COMPLETED_NO));
-}
-
void
TAO_Default_Endpoint_Selector::forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile
diff --git a/TAO/tao/Invocation_Endpoint_Selectors.h b/TAO/tao/Invocation_Endpoint_Selectors.h
index 3448d00e9b6..6701bce3e05 100644
--- a/TAO/tao/Invocation_Endpoint_Selectors.h
+++ b/TAO/tao/Invocation_Endpoint_Selectors.h
@@ -56,15 +56,6 @@ public:
ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0;
/**
- * This method must be called when previously selected endpoint
- * didn't work out, and we want to try another one, i.e., reselect.
- * This method performs the necessary state updates, so that next
- * <select_endpoint> call picks a new endpoint.
- */
- virtual void next (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0;
-
- /**
* This method must be called if the invocation attempt on a
* selected endpoint resulted in location forward. This method
* performs the necessary state updates, so that next <select_endpoint>
@@ -108,20 +99,18 @@ public:
virtual ~TAO_Default_Endpoint_Selector (void);
virtual void select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
- virtual void next (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ ACE_ENV_ARG_DECL);
virtual void forward (TAO_GIOP_Invocation *invocation,
const TAO_MProfile &mprofile
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ ACE_ENV_ARG_DECL);
virtual void success (TAO_GIOP_Invocation *invocation);
virtual void close_connection (TAO_GIOP_Invocation *invocation);
protected:
/// This method selects an endpoint from the profile in the
/// invocation object.
- int endpoint_from_profile (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
+ virtual int endpoint_from_profile (TAO_GIOP_Invocation *invocation
+ ACE_ENV_ARG_DECL);
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 284fcbb89d9..e636d96c696 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -780,6 +780,14 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL)
ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), -1);
}
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBSingleReadOptimization"))))
+ {
+ this->orb_params ()->single_read_optimization
+ (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
////////////////////////////////////////////////////////////////
// catch any unknown -ORB args //
////////////////////////////////////////////////////////////////
diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h
index 8edfcc69027..875429df5c1 100644
--- a/TAO/tao/Pluggable_Messaging.h
+++ b/TAO/tao/Pluggable_Messaging.h
@@ -36,7 +36,7 @@ class TAO_Queued_Data;
// @@ The more I think I about this class, I feel that this class need
// not be a ABC as it is now. Instead we have these options
// (1) Parametrize this class with the "Messaging Object". Then the
-// implementations can just redirect the request to the class
+// implementations can just redirect the request to the class
// that it has been specialised with
// (2) Use a bridge pattern here ie. the interface exposed by this
// class will redirect the request to the implementation which
@@ -102,8 +102,8 @@ public:
* number of bytes that needs to be read from the connection.
*/
virtual int read_message (TAO_Transport *transport,
- int block = 0,
- ACE_Time_Value *max_wait_time = 0) = 0;
+ int block = 0,
+ ACE_Time_Value *max_wait_time = 0) = 0;
/// Format the message in the <cdr>. May not be needed in
/// general.
@@ -111,7 +111,7 @@ public:
/// Do any initialisations that may be needed.
virtual void init (CORBA::Octet major,
- CORBA::Octet minor) = 0;
+ CORBA::Octet minor) = 0;
/// Parse the incoming messages..
virtual int parse_incoming_messages (ACE_Message_Block &message_block) = 0;
@@ -128,20 +128,20 @@ public:
* 0 if there are no more messages in <incoming>.
*/
virtual int extract_next_message (ACE_Message_Block &incoming,
- TAO_Queued_Data *&qd) = 0;
+ TAO_Queued_Data *&qd) = 0;
/// Check whether the node <qd> needs consolidation from <incoming>
virtual int consolidate_node (TAO_Queued_Data *qd,
- ACE_Message_Block &incoming) = 0;
+ ACE_Message_Block &incoming) = 0;
/// @@Bala:Docu??
virtual int consolidate_fragments (TAO_Queued_Data *dqd,
- const TAO_Queued_Data *sqd) = 0;
+ const TAO_Queued_Data *sqd) = 0;
/// Parse the request message, make an upcall and send the reply back
/// to the "request initiator"
virtual int process_request_message (TAO_Transport *transport,
- TAO_Queued_Data *qd) = 0;
+ TAO_Queued_Data *qd) = 0;
/// Parse the reply message that we received and return the reply
@@ -163,6 +163,9 @@ public:
/// Reset the messaging the object
virtual void reset (void) = 0;
+
+ /// Header length
+ virtual size_t header_length (void) const = 0;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/Protocols_Hooks.h b/TAO/tao/Protocols_Hooks.h
index 435c9bac814..0b7e2069954 100644
--- a/TAO/tao/Protocols_Hooks.h
+++ b/TAO/tao/Protocols_Hooks.h
@@ -66,9 +66,9 @@ public:
CORBA::Short &server_priority) = 0;
virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
CORBA::Short &min_priority,
CORBA::Short &max_priority,
- CORBA::Short &p,
int &in_range) = 0;
/**
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp
index 449ff38705b..541ac33ea80 100644
--- a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp
@@ -14,166 +14,20 @@ ACE_RCSID (tao,
RT_Endpoint_Selector_Factory::RT_Endpoint_Selector_Factory (void)
{
- ACE_NEW (this->priority_endpoint_selector_,
- TAO_Priority_Endpoint_Selector);
-
- ACE_NEW (this->bands_endpoint_selector_,
- TAO_Bands_Endpoint_Selector);
-
- ACE_NEW (this->protocol_endpoint_selector_,
- TAO_Protocol_Endpoint_Selector);
-
- ACE_NEW (this->priority_protocol_selector_,
- TAO_Priority_Protocol_Selector);
-
- ACE_NEW (this->bands_protocol_selector_,
- TAO_Bands_Protocol_Selector);
-
- ACE_NEW (this->rt_default_endpoint_selector_,
- TAO_RT_Default_Endpoint_Selector);
+ ACE_NEW (this->rt_invocation_endpoint_selector_,
+ TAO_RT_Invocation_Endpoint_Selector);
}
RT_Endpoint_Selector_Factory::~RT_Endpoint_Selector_Factory (void)
{
- delete this->priority_endpoint_selector_;
- delete this->bands_endpoint_selector_;
- delete this->protocol_endpoint_selector_;
- delete this->priority_protocol_selector_;
- delete this->bands_protocol_selector_;
- delete this->rt_default_endpoint_selector_;
+ delete this->rt_invocation_endpoint_selector_;
}
TAO_Invocation_Endpoint_Selector *
RT_Endpoint_Selector_Factory::get_selector (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL)
-{
- // Initialize selection state with all RTCORBA policies affecting
- // endpoint selection.
-
- TAO_RT_Stub *rt_stub =
- ACE_dynamic_cast (TAO_RT_Stub *, invocation->stub ());
-
- if (rt_stub == 0)
- {
- ACE_DEBUG ((LM_DEBUG, "Unexpected error narrowing stub to TAO_RT_Stub"));
-
- ACE_THROW_RETURN (CORBA::INTERNAL (
- CORBA_SystemException::_tao_minor_code (
- TAO_DEFAULT_MINOR_CODE,
- EINVAL),
- CORBA::COMPLETED_NO),
- 0);
- }
-
- CORBA::Policy_var priority_model_policy =
- rt_stub->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // state.private_connection_ =
- // rt_stub->private_connection ();
-
- CORBA::Policy_var client_protocol_policy =
- TAO_RT_Endpoint_Utils::client_protocol_policy (invocation ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Policy_var bands_policy = TAO_RT_Endpoint_Utils::priority_bands_policy (invocation ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- //
- // Look at RTCORBA policies to decide on appropriate selector.
- //
-
- // CASE 2: No PriorityModelPolicy set.
- if (priority_model_policy.ptr () == 0)
- {
- // Bands without priority model do not make sense.
- if (bands_policy.ptr () != 0)
- {
- if (invocation->inconsistent_policies ().ptr ())
- {
- invocation->inconsistent_policies ()->length (1);
- invocation->inconsistent_policies ()[0u] =
- CORBA::Policy::_duplicate (bands_policy.in ());
- }
- ACE_THROW_RETURN (CORBA::INV_POLICY (), 0);
- }
-
- if (client_protocol_policy.ptr () == 0)
- return this->rt_default_endpoint_selector_;
- else
- return this->protocol_endpoint_selector_;
- }
-
- // @@ This is to be used in case 3:
- CORBA::Short server_priority = 0;
- CORBA::Boolean is_client_propagated = 0;
-
- TAO_Protocols_Hooks *tph = invocation->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- tph->get_selector_hook (priority_model_policy.in (),
- is_client_propagated,
- server_priority);
-
- // CASE 3: PriorityBandedConnection Policy is set.
- if (bands_policy.ptr () != 0)
- {
- // Matching band found. Instantiate appropriate selector.
- if (client_protocol_policy.ptr () == 0)
- return this->bands_endpoint_selector_;
- else
- return this->bands_protocol_selector_;
- }
-
- // CASE 4: CLIENT_PROPAGATED priority model, no bands.
- if (is_client_propagated)
- {
- if (client_protocol_policy.ptr () == 0)
- return this->priority_endpoint_selector_;
- else
- return this->priority_protocol_selector_;
- }
- else
- {
- // CASE 5: SERVER_DECLARED priority model, no bands.
- if (client_protocol_policy.ptr () == 0)
- return this->rt_default_endpoint_selector_;
- else
- return this->protocol_endpoint_selector_;
- }
-}
-
-
-void
-RT_Endpoint_Selector_Factory::
-init_client_protocol (TAO_GIOP_Invocation *
- ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_ENV_ARG_DECL)
{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RT_Endpoint_Selector_Factory:init_client_protocol - Is deprecated!")));
- /*
- TAO_RT_Stub *rt_stub =
- ACE_dynamic_cast (TAO_RT_Stub *, invocation->stub_);
-
- ACE_TRY
- {
- invocation->endpoint_selection_state_.client_protocol_policy_ =
- rt_stub->effective_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCH (CORBA::INV_POLICY, ex)
- {
- if (invocation->inconsistent_policies_.ptr ())
- {
- invocation->inconsistent_policies_->length (1);
- invocation->inconsistent_policies_[0u] =
- rt_stub->client_protocol ();
- }
- ACE_RE_THROW;
- }
- ACE_ENDTRY;
- ACE_CHECK;
-
- */
+ return this->rt_invocation_endpoint_selector_;
}
// ****************************************************************
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
index d0d36a772c4..7aea8e82088 100644
--- a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
@@ -27,29 +27,22 @@
#include "tao/Endpoint_Selector_Factory.h"
#include "ace/Service_Config.h"
-class TAO_Priority_Endpoint_Selector;
-class TAO_Bands_Endpoint_Selector;
-class TAO_Protocol_Endpoint_Selector;
-class TAO_Priority_Protocol_Selector;
-class TAO_Bands_Protocol_Selector;
-class TAO_RT_Default_Endpoint_Selector;
+class TAO_RT_Invocation_Endpoint_Selector;
// ****************************************************************
/**
* @class RT_Endpoint_Selector_Factory
*
- * @brief Factory for initializing <Endpoint_Selection_State> and
- * obtaining appropriate <Invocation_Endpoint_Selector>.
+ * @brief Factory for obtaining appropriate <Invocation_Selector>.
*
* Used by Invocation classes to intialize its endpoint selection
- * strategy and state based on the effective policies.
- * Endpoint selection strategies are stateless objects - all the
- * state they need is contained by Invocation in
- * <Endpoint_Selection_State>. Thus, rather than allocating an
- * endpoint selection strategy object for each Invocation, the
- * factory simply returns the appropriate one from the
- * set preallocated in the ORB_Core. One endpoint selection
- * strategy object can be used by many invocations concurrently.
+ * strategy and state based on the effective policies. Endpoint
+ * selection strategies are stateless objects - all the state they
+ * need is contained by Invocation. Thus, rather than allocating an
+ * endpoint selection strategy object for each Invocation, the factory
+ * simply returns the appropriate one from the set preallocated in the
+ * ORB_Core. One endpoint selection strategy object can be used by
+ * many invocations concurrently.
*/
class TAO_RTCORBA_Export RT_Endpoint_Selector_Factory
: public TAO_Endpoint_Selector_Factory
@@ -63,34 +56,11 @@ public:
/// Get an Invocation's endpoint selection strategy and
/// initialize the endpoint selection state instance.
- virtual TAO_Invocation_Endpoint_Selector *get_selector (
- TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-
-protected:
-
- // = Helpers for <get_selector>.
-
- /// Initializes RTCORBA::ClientProtocolPolicy in the endpoint
- /// selection state.
- void init_client_protocol (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-
- /// Initializes RTCORBA::PriorityBandsPolicy in the endpoint
- /// selection state.
- // void init_bands (TAO_GIOP_Invocation *invocation,
- // ACE_ENV_SINGLE_ARG_DECL);
+ virtual TAO_Invocation_Endpoint_Selector *get_selector (TAO_GIOP_Invocation *invocation
+ ACE_ENV_ARG_DECL);
private:
- /// The possible endpoint selector strategies that can be
- /// returned by this factory
-
- TAO_RT_Default_Endpoint_Selector *rt_default_endpoint_selector_;
- TAO_Priority_Endpoint_Selector *priority_endpoint_selector_;
- TAO_Bands_Endpoint_Selector *bands_endpoint_selector_;
- TAO_Protocol_Endpoint_Selector *protocol_endpoint_selector_;
- TAO_Priority_Protocol_Selector *priority_protocol_selector_;
- TAO_Bands_Protocol_Selector *bands_protocol_selector_;
+ TAO_RT_Invocation_Endpoint_Selector *rt_invocation_endpoint_selector_;
};
ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, RT_Endpoint_Selector_Factory)
diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp
index 34a3236e2d8..ce4264caffa 100644
--- a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp
+++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp
@@ -20,544 +20,308 @@
ACE_RCSID(tao, RT_Invocation_Endpoint_Selectors, "$Id$")
-// ****************************************************************
-
void
-TAO_RT_Default_Endpoint_Selector::select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL)
+TAO_RT_Invocation_Endpoint_Selector::select_endpoint (TAO_GIOP_Invocation *invocation
+ ACE_ENV_ARG_DECL)
{
- TAO_RT_Stub *rt_stub =
- ACE_dynamic_cast (TAO_RT_Stub *,
- invocation->stub ());
+ CORBA::Policy_var client_protocol_policy_base =
+ TAO_RT_Endpoint_Utils::client_protocol_policy (invocation ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
- do
+ if (client_protocol_policy_base.ptr () == 0)
{
- invocation->profile (invocation->stub ()->profile_in_use ());
- invocation->endpoint (invocation->profile ()->endpoint ());
-
- // If known endpoint, select it.
- if (invocation->endpoint () != 0)
- {
- int status;
- if (rt_stub->private_connection ())
- {
- TAO_Private_Transport_Descriptor private_desc (invocation->endpoint (),
- ACE_reinterpret_cast (long, invocation->stub ()));
-
- status = invocation->perform_call (private_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
- else
- {
- TAO_Base_Transport_Property default_desc (invocation->endpoint ());
-
- status = invocation->perform_call (default_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
-
- // Check if the invocation has completed.
- if (status == 1)
- return;
- }
+ this->TAO_Default_Endpoint_Selector::select_endpoint (invocation
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
}
- while (invocation->stub ()->next_profile_retry () != 0);
+ else
+ {
+ RTCORBA::ClientProtocolPolicy_var client_protocol_policy =
+ RTCORBA::ClientProtocolPolicy::_narrow (client_protocol_policy_base.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
- // If we get here, we completely failed to find an endpoint selector
- // that we know how to use, so throw an exception.
- ACE_THROW (CORBA::TRANSIENT (TAO_OMG_VMCID | 2,
- CORBA::COMPLETED_NO));
-}
+ /// Cast to TAO_ClientProtocolPolicy
+ TAO_ClientProtocolPolicy *tao_client_protocol_policy =
+ ACE_static_cast (TAO_ClientProtocolPolicy *,
+ client_protocol_policy.in ());
-// ****************************************************************
+ /// Get the ProtocolList
+ RTCORBA::ProtocolList &client_protocols =
+ tao_client_protocol_policy->protocols_rep ();
-TAO_Priority_Endpoint_Selector::~TAO_Priority_Endpoint_Selector (void)
-{
+ this->select_endpoint_based_on_client_protocol_policy (invocation,
+ client_protocol_policy,
+ client_protocols
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
}
void
-TAO_Priority_Endpoint_Selector::select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL)
+TAO_RT_Invocation_Endpoint_Selector::select_endpoint_based_on_client_protocol_policy (TAO_GIOP_Invocation *invocation,
+ RTCORBA::ClientProtocolPolicy_ptr client_protocol_policy,
+ RTCORBA::ProtocolList &client_protocols
+ ACE_ENV_ARG_DECL)
{
- TAO_RT_Stub *rt_stub = ACE_dynamic_cast (TAO_RT_Stub *,
- invocation->stub ());
- CORBA::Short client_priority;
-
- // Get client priority.
- TAO_Protocols_Hooks *tph = invocation->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK;
-
- if (tph->get_thread_CORBA_priority (client_priority
- ACE_ENV_ARG_PARAMETER)
- == -1)
- ACE_THROW (CORBA::DATA_CONVERSION (1,
- CORBA::COMPLETED_NO));
-
- do
+ CORBA::Boolean valid_profile_found = 0;
+
+ // Even though cycling through all the protocols is the correct
+ // things to do to find a match, starting from the start of the
+ // profile list is not. In addition, this code is also ignoring the
+ // forwarded reference (if it exists). This behavior is caused by
+ // problems with the profile management in TAO which are documented
+ // in bugzilla bugs 1237, 1238, and 1239. Once the above problems
+ // are fixed, this behavior should be fixed to do the right thing.
+ for (CORBA::ULong protocol_index = 0;
+ protocol_index < client_protocols.length ();
+ ++protocol_index)
{
- // Obtain profile.
- invocation->profile (invocation->stub ()->profile_in_use ());
-
- // Select an endpoint from the profile.
-
- if (invocation->profile ()->endpoint_count () == 0)
- {
- // Unknown protocol - move onto the next profile.
- continue;
- }
+ // Find the profiles that match the current protocol.
+ TAO_Profile *profile = 0;
+ TAO_MProfile &mprofile = invocation->stub ()->base_profiles ();
- else if (invocation->profile ()->endpoint_count () == 1)
- {
- // Profile contains just one endpoint. This happens when:
- // a) we are talking to a nonTAO server (which doesn't have
- // the concept of multiple endpoints per profile)
- // or
- // b) we have TAO server with a non-lane threadpool, in which
- // case there is only one acceptor
- // In both cases we should use the endpoint regardless of its priority.
- invocation->endpoint (invocation->profile ()->endpoint ());
- }
- else
+ for (TAO_PHandle i = 0;
+ i < mprofile.profile_count ();
+ ++i)
{
- // Profiles contains more than one endpoint. Find one with the
- // right priority.
+ profile = mprofile.get_profile (i);
- TAO_Endpoint *endpoint = 0;
- for (TAO_Endpoint *endp = invocation->profile ()->endpoint ();
- endp != 0;
- endp = endp->next ())
+ if (profile->tag () == client_protocols[protocol_index].protocol_type)
{
- if (endp->priority () == client_priority)
- {
- endpoint = endp;
- break;
- }
- }
+ valid_profile_found = 1;
- if (endpoint != 0)
- {
- // Found an Endpoint with correct priority.
- invocation->endpoint (endpoint);
- }
- else
- {
- // The profile didn't contain an endpoint with matching priority.
- // There are two possibilities:
- // a) the server is a multi-homed host and this is the
- // only reason for profile containing more than 1
- // endpoint, i.e., case a) above.
- // b) we have misconfiguration - threadpool with lanes on
- // the server, and client priority not matching any of
- // the lanes.
- if (this->is_multihomed (invocation->profile ()->endpoint ()))
- {
- // case a
- invocation->endpoint (invocation->profile ()->endpoint ());
- }
- else
- // case b
- {
- if (invocation->inconsistent_policies ().ptr ())
- {
- CORBA::Policy_var priority_model_policy = rt_stub->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK;
+ invocation->profile (profile);
+ invocation->endpoint (invocation->profile ()->endpoint ());
- invocation->inconsistent_policies ()->length (1);
- invocation->inconsistent_policies ()[0u] =
- CORBA::Policy::_duplicate (priority_model_policy.in ());
- }
- ACE_THROW (CORBA::INV_POLICY ());
- }
+ int status =
+ this->endpoint_from_profile (invocation ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (status == 1)
+ return;
+ // @@ Else we should check for potential forwarding here.
}
}
+ }
- // Try to perform the invocation using this endpoint.
- int status;
- if (rt_stub->private_connection ())
- {
- TAO_Private_Transport_Descriptor private_desc (invocation->endpoint (),
- ACE_reinterpret_cast (long, invocation->stub ()));
-
- status = invocation->perform_call (private_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
- else
+ // We have tried all the profiles specified in the client protocol
+ // policy with no success. Throw exception.
+ if (!valid_profile_found)
+ {
+ if (invocation->inconsistent_policies ().ptr ())
{
- TAO_Base_Transport_Property default_desc (invocation->endpoint ());
-
- status = invocation->perform_call (default_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
+ invocation->inconsistent_policies ()->length (1);
+ invocation->inconsistent_policies ()[0u] =
+ CORBA::Policy::_duplicate (client_protocol_policy);
}
-
- // Check if the invocation has completed.
- if (status == 1)
- return;
+ ACE_THROW (CORBA::INV_POLICY ());
}
- while (invocation->stub ()->next_profile_retry () != 0);
- // If we get here, we completely failed to find an endpoint selector
- // that we know how to use, so throw an exception.
+ // If we get here, we found at least one pertinent profile, but no
+ // usable endpoints.
ACE_THROW (CORBA::TRANSIENT (TAO_OMG_VMCID | 2,
CORBA::COMPLETED_NO));
}
int
-TAO_Priority_Endpoint_Selector::is_multihomed (TAO_Endpoint *endpoint)
+TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile (TAO_GIOP_Invocation *invocation
+ ACE_ENV_ARG_DECL)
{
- for (TAO_Endpoint *endp = endpoint;
- endp != 0;
- endp = endp->next ())
+ // Narrow to the RT Stub.
+ TAO_RT_Stub *rt_stub =
+ ACE_dynamic_cast (TAO_RT_Stub *, invocation->stub ());
+
+ if (rt_stub == 0)
{
- if (endp->next () != 0
- && endp->priority () != endp->next ()->priority ())
- return 0;
+ ACE_DEBUG ((LM_DEBUG, "Unexpected error narrowing stub to TAO_RT_Stub"));
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ 0);
}
- return 1;
-}
-
-// ****************************************************************
-
-TAO_Bands_Endpoint_Selector::~TAO_Bands_Endpoint_Selector (void)
-{
-}
-void
-TAO_Bands_Endpoint_Selector::select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL)
-{
- TAO_RT_Stub *rt_stub = ACE_dynamic_cast (TAO_RT_Stub *,
- invocation->stub ());
- TAO_Protocols_Hooks *protocol_hooks =
- invocation->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK;
-
- CORBA::Policy_var bands_policy = TAO_RT_Endpoint_Utils::priority_bands_policy (invocation
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
-
- // Figure out target priority.
+ // Get the priority model policy.
CORBA::Policy_var priority_model_policy =
rt_stub->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK;
+ ACE_CHECK_RETURN (0);
- CORBA::Short server_priority = 0;
- CORBA::Boolean is_client_propagated = 0;
- protocol_hooks->get_selector_hook (
- priority_model_policy.in (), // input
- is_client_propagated, // side effect
- server_priority); // side effect
+ // Get the bands policy.
+ CORBA::Policy_var bands_policy =
+ TAO_RT_Endpoint_Utils::priority_bands_policy (invocation
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ int all_endpoints_are_valid = 0;
+ int match_priority = 0;
+ int match_bands = 0;
+ CORBA::Short client_thread_priority = 0;
+ CORBA::Short min_priority = 0;
+ CORBA::Short max_priority = 0;
- CORBA::Short p;
- if (is_client_propagated)
+ // If the priority model policy is not set.
+ if (priority_model_policy.ptr () == 0)
{
- // Get Client priority.
-
- int status =
- protocol_hooks->get_thread_CORBA_priority (p // side effect
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- if (status == -1)
+ // Bands without priority model do not make sense.
+ if (bands_policy.ptr () != 0)
{
- ACE_THROW (CORBA::DATA_CONVERSION (1,
- CORBA::COMPLETED_NO));
+ if (invocation->inconsistent_policies ().ptr ())
+ {
+ invocation->inconsistent_policies ()->length (1);
+ invocation->inconsistent_policies ()[0u] =
+ CORBA::Policy::_duplicate (bands_policy.in ());
+ }
+ // Indicate error.
+ ACE_THROW_RETURN (CORBA::INV_POLICY (), 0);
}
+
+ // No priority model policy (and no bands policy): all endpoints
+ // are fair game.
+ all_endpoints_are_valid = 1;
}
+ // If the priority model policy is set.
else
- p = server_priority;
-
- int in_range = 0;
-
- CORBA::Short min_priority;
- CORBA::Short max_priority;
-
- protocol_hooks->get_selector_bands_policy_hook (bands_policy.in (),
- min_priority,
- max_priority,
- p,
- in_range);
-
- // If priority doesn't fall into any of the bands
- if (!in_range)
{
- if (invocation->inconsistent_policies ().ptr ())
- {
- invocation->inconsistent_policies ()->length (2);
- invocation->inconsistent_policies ()[0u] =
- CORBA::Policy::_duplicate (bands_policy.in ());
- invocation->inconsistent_policies ()[1u] =
- CORBA::Policy::_duplicate (priority_model_policy.in ());
- }
- ACE_THROW (CORBA::INV_POLICY ());
- }
+ // Get the protocol hooks.
+ TAO_Protocols_Hooks *protocol_hooks =
+ invocation->orb_core ()->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
- do
- {
- // Obtain profile.
- invocation->profile (invocation->stub ()->profile_in_use ());
+ CORBA::Short server_priority = 0;
+ CORBA::Boolean is_client_propagated = 0;
- // Select an endpoint from the profile.
+ // Check the priority model policy to see if it is client
+ // propagated.
+ protocol_hooks->get_selector_hook (priority_model_policy.in (),
+ is_client_propagated,
+ server_priority);
- if (invocation->profile ()->endpoint_count () == 0)
+ if (!is_client_propagated)
{
- // Unknown protocol - move onto the next profile.
- continue;
- }
-
- else if (invocation->profile ()->endpoint_count () == 1)
- {
- // Profile contains just one endpoint. This happens when:
- // a) we are talking to a nonTAO server (which doesn't have
- // the concept of multiple endpoints per profile)
- // or
- // b) we have TAO server with a non-lane threadpool, in which
- // case there is only one acceptor
- // In both cases we should use the endpoint regardless of its priority.
- invocation->endpoint (invocation->profile ()->endpoint ());
+ // Server declared: all endpoints are fair game.
+ all_endpoints_are_valid = 1;
}
+ // Client propagated.
else
{
- // Profiles contains more than one endpoint. Find one with the
- // right priority.
-
- TAO_Endpoint *endpoint = 0;
- for (TAO_Endpoint *endp = invocation->profile ()->endpoint ();
- endp != 0;
- endp = endp->next ())
+ // Get client thread priority.
+ int status =
+ protocol_hooks->get_thread_CORBA_priority (client_thread_priority // side effect
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ if (status == -1)
{
- if (endp->priority () <= max_priority
- && endp->priority () >= min_priority)
- {
- if (TAO_debug_level > 1)
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) TAO Endpoint Selection: priority = %d, band = [%d %d], endpoint = %d\n",
- p,
- min_priority,
- max_priority,
- endp->priority ()));
- }
- endpoint = endp;
- break;
- }
- }
+ ACE_THROW (CORBA::DATA_CONVERSION (1,
+ CORBA::COMPLETED_NO));
+ }
- if (endpoint != 0)
+ // If there are no bands.
+ if (bands_policy.ptr () == 0)
{
- // Found an Endpoint with correct priority.
- invocation->endpoint (endpoint);
+ // Match the priority of the client thread with the
+ // endpoint.
+ match_priority = 1;
}
+ // There are bands.
else
{
- if (invocation->inconsistent_policies ().ptr ())
+ // Get the bands.
+ RTCORBA::PriorityBandedConnectionPolicy_var bands_policy_ptr =
+ RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands_policy);
+
+ TAO_PriorityBandedConnectionPolicy *priority_bands_policy =
+ ACE_static_cast (TAO_PriorityBandedConnectionPolicy *,
+ bands_policy_ptr.in ());
+
+ RTCORBA::PriorityBands &bands =
+ priority_bands_policy->priority_bands_rep ();
+
+ // Check which band range we fall in.
+ int in_range = 0;
+ protocol_hooks->get_selector_bands_policy_hook (bands_policy.in (),
+ client_thread_priority,
+ min_priority,
+ max_priority,
+ in_range);
+
+ // If priority doesn't fall into any of the bands.
+ if (!in_range)
{
- invocation->inconsistent_policies ()->length (1);
- invocation->inconsistent_policies ()[0u] =
- CORBA::Policy::_duplicate (bands_policy.in ());
- }
- ACE_THROW (CORBA::INV_POLICY ());
- }
- }
-
- // Try to perform the invocation using this endpoint.
- int status;
- if (rt_stub->private_connection ())
- {
- TAO_Private_Transport_Descriptor private_desc (invocation->endpoint (),
- ACE_reinterpret_cast (long, invocation->stub ()));
+ if (invocation->inconsistent_policies ().ptr ())
+ {
+ invocation->inconsistent_policies ()->length (2);
+ invocation->inconsistent_policies ()[0u] =
+ CORBA::Policy::_duplicate (bands_policy.in ());
+ invocation->inconsistent_policies ()[1u] =
+ CORBA::Policy::_duplicate (priority_model_policy.in ());
+ }
- status = invocation->perform_call (private_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
- else
- {
- TAO_Base_Transport_Property default_desc (invocation->endpoint ());
+ // Indicate error.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
- status = invocation->perform_call (default_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
+ // Match the priority of the band with the endpoint.
+ match_bands = 1;
+ }
}
-
- // Check if the invocation has completed.
- if (status == 1)
- return;
}
- while (invocation->stub ()->next_profile_retry () != 0);
-
- // If we get here, we completely failed to find an endpoint selector
- // that we know how to use, so throw an exception.
- ACE_THROW (CORBA::TRANSIENT (TAO_OMG_VMCID | 2,
- CORBA::COMPLETED_NO));
-
-
-}
-
-// ****************************************************************
-
-TAO_Protocol_Endpoint_Selector::~TAO_Protocol_Endpoint_Selector (void)
-{
-}
-
-void
-TAO_Protocol_Endpoint_Selector::select_endpoint (TAO_GIOP_Invocation
- *invocation
- ACE_ENV_ARG_DECL)
-{
- /// Narrow down to the right policy.
- CORBA::Policy_var cp =
- TAO_RT_Endpoint_Utils::client_protocol_policy (invocation ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
-
- RTCORBA::ClientProtocolPolicy_var cp_policy =
- RTCORBA::ClientProtocolPolicy::_narrow (cp.in () ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- /// Cast to TAO_ClientProtocolPolicy
- TAO_ClientProtocolPolicy *client_protocol_policy =
- ACE_static_cast (TAO_ClientProtocolPolicy *,
- cp_policy.in ());
-
- /// Get the ProtocolList
- RTCORBA::ProtocolList & protocols =
- client_protocol_policy->protocols_rep ();
-
- TAO_RT_Stub *rt_stub = ACE_dynamic_cast (TAO_RT_Stub *,
- invocation->stub ());
-
- CORBA::Boolean valid_endpoint_found = 0;
-
- for (CORBA::ULong protocol_index = 0;
- protocol_index < protocols.length ();
- protocol_index++)
+ while (invocation->endpoint () != 0)
{
- // Find the profiles that match the current protocol.
- TAO_Profile *profile = 0;
- TAO_MProfile& mprofile = invocation->stub ()->base_profiles ();
-
- for (TAO_PHandle i = 0;
- i < mprofile.profile_count ();
- ++i)
+ // Get the priority of the endpoint.
+ CORBA::Short endpoint_priority =
+ invocation->endpoint ()->priority ();
+
+ // If <all_endpoints_are_valid> or match the priority of the
+ // client thread or match the priority of the band or
+ // profile contains just one endpoint. This happens when:
+ // a) we are talking to a nonTAO server (which doesn't have
+ // the concept of multiple endpoints per profile)
+ // or
+ // b) we have TAO server with a non-lane threadpool, in which
+ // case there is only one acceptor
+ // In both cases we should use the endpoint regardless of its priority.
+
+ if (all_endpoints_are_valid ||
+ (match_priority &&
+ client_thread_priority == endpoint_priority) ||
+ (match_bands &&
+ endpoint_priority <= max_priority &&
+ endpoint_priority >= min_priority) ||
+ invocation->profile ()->endpoint_count () == 1 &&
+ endpoint_priority == TAO_INVALID_PRIORITY)
{
- profile = mprofile.get_profile (i);
- if (profile->tag ()
- == protocols[protocol_index].protocol_type)
+ int status;
+ if (rt_stub->private_connection ())
{
- // Save away the profile and endpoint that we found in the
- // invocation.
- invocation->profile (profile);
- invocation->endpoint (profile->endpoint());
- valid_endpoint_found = 1;
-
- // Try to perform the invocation using this endpoint.
- int status;
- if (rt_stub->private_connection ())
- {
- TAO_Private_Transport_Descriptor private_desc (invocation->endpoint (),
- ACE_reinterpret_cast (long, invocation->stub ()));
-
- status = invocation->perform_call (private_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
- else
- {
- TAO_Base_Transport_Property default_desc (invocation->endpoint ());
-
- status = invocation->perform_call (default_desc ACE_ENV_ARG_PARAMETER);
- ACE_CHECK;
- }
+ TAO_Private_Transport_Descriptor private_desc (invocation->endpoint (),
+ ACE_reinterpret_cast (long, invocation->stub ()));
- // Check if the invocation has completed.
- if (status == 1)
- return;
+ status =
+ invocation->perform_call (private_desc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
}
- }
- }
+ else
+ {
+ TAO_Base_Transport_Property default_desc (invocation->endpoint ());
- // We have tried all the protocols specified in the client
- // protocol policy with no success. Throw exception.
+ status =
+ invocation->perform_call (default_desc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
- // Figure out proper exception.
- if (!valid_endpoint_found)
- {
- if (invocation->inconsistent_policies ().ptr ())
- {
- invocation->inconsistent_policies ()->length (1);
- invocation->inconsistent_policies ()[0u] =
- CORBA::Policy::_duplicate (client_protocol_policy);
+ // Check if the invocation has completed.
+ if (status == 1)
+ return 1;
}
- ACE_THROW (CORBA::INV_POLICY ());
- }
-
- // If we get here, we completely failed to find an endpoint selector
- // that we know how to use, so throw an exception.
- ACE_THROW (CORBA::TRANSIENT (TAO_OMG_VMCID | 2,
- CORBA::COMPLETED_NO));
-
-}
-
-void
-TAO_Protocol_Endpoint_Selector::next (TAO_GIOP_Invocation
- *
- ACE_ENV_ARG_DECL_NOT_USED)
-{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("You Are not Suppesed to call: TAO_Protocol_Endpoint_Selector::next!!!\n")));
- // invocation->profile_index ()++;
- // If we ran out of profiles to try - this will be detected and
- // exception thrown once <endpoint> is called.
-}
-
-void
-TAO_Protocol_Endpoint_Selector::forward (TAO_GIOP_Invocation
- *invocation,
- const TAO_MProfile& /* mprofile */
- ACE_ENV_ARG_DECL)
-{
- // Location forwarding is currently not supported when using
- // RTCORBA::ClientProtocolPolicy. With the current profile
- // management scheme being broken, it would be a pain to support here.
- // @@ Add support for location forwarding once profile management is
- // redesigned.
-
- // Currently location forward replies are ignored. When we receive
- // a location forward reply, we act as if the profile we used
- // didn't work, and we try the next one. Should we throw not
- // supported exception instead?
- this->next (invocation ACE_ENV_ARG_PARAMETER);
-}
-
-void
-TAO_Protocol_Endpoint_Selector::success (TAO_GIOP_Invocation *invocation)
-{
- invocation->stub ()->set_valid_profile ();
-}
-
-void
-TAO_Protocol_Endpoint_Selector::close_connection (TAO_GIOP_Invocation *)
-{
-}
-
-// ****************************************************************
-
-TAO_Priority_Protocol_Selector::~TAO_Priority_Protocol_Selector (void)
-{
-}
-
-int
-TAO_Priority_Protocol_Selector::is_multihomed (TAO_Endpoint *endpoint)
-{
- for (TAO_Endpoint *endp = endpoint;
- endp != 0;
- endp = endp->next ())
- {
- if (endp->next () != 0
- && endp->priority () != endp->next ()->priority ())
- return 0;
+ // Go to the next endpoint in this profile.
+ invocation->endpoint (invocation->endpoint()->next());
}
- return 1;
-}
-
-// ****************************************************************
-TAO_Bands_Protocol_Selector::~TAO_Bands_Protocol_Selector (void)
-{
+ return 0;
}
diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h
index 188d08fe210..0980582c5ae 100644
--- a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h
+++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h
@@ -20,7 +20,7 @@
#include "ace/pre.h"
#include "tao/corbafwd.h"
-#include "rtcorba_export.h"
+#include "RTCORBA.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -32,154 +32,29 @@ class TAO_MProfile;
class TAO_Endpoint;
/**
- * @class TAO_RT_Default_Endpoint_Selector
+ * @class TAO_RT_Invocation_Endpoint_Selector
*
- * @brief TAO_RT_Default_Endpoint_Selector
+ * @brief TAO_RT_Invocation_Endpoint_Selector
*
* This strategy is used when the only policy that might be set is the
* private connection policy.
*
**/
-class TAO_RTCORBA_Export TAO_RT_Default_Endpoint_Selector :
+class TAO_RTCORBA_Export TAO_RT_Invocation_Endpoint_Selector :
public TAO_Default_Endpoint_Selector
{
public:
- virtual void select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-};
-
-// ****************************************************************
-
-/**
- * @class TAO_Priority_Endpoint_Selector
- *
- * @brief TAO_Priority_Endpoint_Selector
- *
- * This strategy is used when RTCORBA::PriorityModelPolicy is
- * set and its value is RTCORBA::CLIENT_PROPAGATED.
- *
- */
-class TAO_RTCORBA_Export TAO_Priority_Endpoint_Selector :
- public TAO_Default_Endpoint_Selector
-{
-public:
- /// Constructor.
- TAO_Priority_Endpoint_Selector (void);
-
- /// Destructor.
- virtual ~TAO_Priority_Endpoint_Selector (void);
-
- virtual void select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-private:
- /// Helper for <select_endpoint>.
- int is_multihomed (TAO_Endpoint *endpoint);
-};
-
-// ****************************************************************
-
-/**
- * @class TAO_Bands_Endpoint_Selector
- *
- * @brief TAO_Bands_Endpoint_Selector
- *
- * This strategy is used when
- * RTCORBA::PriorityBandedConnectionPolicy is set.
- *
- */
-class TAO_RTCORBA_Export TAO_Bands_Endpoint_Selector :
- public TAO_Default_Endpoint_Selector
-{
-public:
- /// Constructor.
- TAO_Bands_Endpoint_Selector (void);
-
- /// Destructor.
- virtual ~TAO_Bands_Endpoint_Selector (void);
-
- virtual void select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
-};
-
-// ****************************************************************
-
-/**
- * @class TAO_Protocol_Endpoint_Selector
- *
- * @brief TAO_Protocol_Endpoint_Selector
- *
- * This strategy is used when only RTCORBA::ClientProtocolPolicy is
- * set or RTCORBA::ClientProtocolPolicy plus
- * RTCORBA::SERVER_DECLARED priority model.
- *
- */
-class TAO_RTCORBA_Export TAO_Protocol_Endpoint_Selector :
- public TAO_Invocation_Endpoint_Selector
-{
-public:
- /// Constructor.
- TAO_Protocol_Endpoint_Selector (void);
-
- /// Destructor.
- virtual ~TAO_Protocol_Endpoint_Selector (void);
- virtual void select_endpoint (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
- virtual void next (TAO_GIOP_Invocation *invocation
- ACE_ENV_ARG_DECL);
- virtual void forward (TAO_GIOP_Invocation *invocation,
- const TAO_MProfile &mprofile
+ void select_endpoint (TAO_GIOP_Invocation *invocation
ACE_ENV_ARG_DECL);
- virtual void success (TAO_GIOP_Invocation *invocation);
- virtual void close_connection (TAO_GIOP_Invocation *invocation);
-};
-
-// ****************************************************************
-/**
- * @class TAO_Priority_Protocol_Selector
- *
- * @brief TAO_Priority_Protocol_Selector
- *
- * This strategy is used when RTCORBA::ClientProtocolPolicy is
- * set and the priority model is RTCORBA::CLIENT_PROPAGATED.
- *
- */
-class TAO_RTCORBA_Export TAO_Priority_Protocol_Selector :
- public TAO_Protocol_Endpoint_Selector
-{
-public:
- /// Constructor.
- TAO_Priority_Protocol_Selector (void);
-
- /// Destructor.
- virtual ~TAO_Priority_Protocol_Selector (void);
-
-protected:
- /// Helper for <select_endpoint>.
- int is_multihomed (TAO_Endpoint *endpoint);
-};
-
-// ****************************************************************
-
-/**
- * @class TAO_Bands_Protocol_Selector
- *
- * @brief TAO_Bands_Protocol_Selector
- *
- * This strategy is used when both RTCORBA::ClientProtocolPolicy
- * and RTCORBA::PriorityBandedConnectionPolicy are set.
- *
- */
-class TAO_RTCORBA_Export TAO_Bands_Protocol_Selector :
- public TAO_Protocol_Endpoint_Selector
-{
-public:
- /// Constructor.
- TAO_Bands_Protocol_Selector (void);
+ void select_endpoint_based_on_client_protocol_policy (TAO_GIOP_Invocation *invocation,
+ RTCORBA::ClientProtocolPolicy_ptr client_protocol_policy,
+ RTCORBA::ProtocolList &protocols
+ ACE_ENV_ARG_DECL);
- /// Destructor.
- virtual ~TAO_Bands_Protocol_Selector (void);
+ int endpoint_from_profile (TAO_GIOP_Invocation *invocation
+ ACE_ENV_ARG_DECL);
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.i b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.i
index 916934eb0f3..c130d6682b1 100644
--- a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.i
+++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.i
@@ -1,35 +1,2 @@
// -*- C++ -*-
// $Id$
-
-ACE_INLINE
-TAO_Priority_Endpoint_Selector::TAO_Priority_Endpoint_Selector (void)
-{
-}
-
-// ****************************************************************
-
-ACE_INLINE
-TAO_Bands_Endpoint_Selector::TAO_Bands_Endpoint_Selector (void)
-{
-}
-
-// ****************************************************************
-
-ACE_INLINE
-TAO_Protocol_Endpoint_Selector::TAO_Protocol_Endpoint_Selector (void)
-{
-}
-
-// ****************************************************************
-
-ACE_INLINE
-TAO_Priority_Protocol_Selector::TAO_Priority_Protocol_Selector (void)
-{
-}
-
-// ****************************************************************
-
-ACE_INLINE
-TAO_Bands_Protocol_Selector::TAO_Bands_Protocol_Selector (void)
-{
-}
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
index a9130638089..244c3c5ab8a 100644
--- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
@@ -178,8 +178,7 @@ TAO_RT_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &servic
}
void
-TAO_RT_Protocols_Hooks::get_selector_hook (
- CORBA::Policy *model_policy,
+TAO_RT_Protocols_Hooks::get_selector_hook (CORBA::Policy *model_policy,
CORBA::Boolean &is_client_propagated,
CORBA::Short &server_priority)
{
@@ -203,9 +202,9 @@ TAO_RT_Protocols_Hooks::get_selector_hook (
void
TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
CORBA::Short &min_priority,
CORBA::Short &max_priority,
- CORBA::Short &p,
int &in_range)
{
RTCORBA::PriorityBandedConnectionPolicy_var bands_policy_ptr =
@@ -220,7 +219,7 @@ TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *bands_pol
priority_bands_policy->priority_bands_rep ();
for (CORBA::ULong i = 0; i < bands.length (); ++i)
- if (bands[i].low <= p && bands[i].high >= p)
+ if (bands[i].low <= priority && bands[i].high >= priority)
{
min_priority = bands[i].low;
max_priority = bands[i].high;
@@ -384,7 +383,7 @@ TAO_RT_Protocols_Hooks::set_default_policies (ACE_ENV_SINGLE_ARG_DECL)
client_protocol_policy;
this->orb_core_->get_default_policies ()->set_policy (client_protocol_policy
- ACE_ENV_ARG_PARAMETER);
+ ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
return 0;
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h
index ffcdd065c30..eb235702591 100644
--- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h
@@ -104,12 +104,11 @@ public:
&is_client_propagated,
CORBA::Short &server_priority);
- virtual void get_selector_bands_policy_hook (
- CORBA::Policy *bands_policy,
- CORBA::Short &min_priority,
- CORBA::Short &max_priority,
- CORBA::Short &p,
- int &in_range);
+ virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ int &in_range);
/**
* Accessor and modifier to the current thread priority, used to
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.cpp b/TAO/tao/Strategies/DIOP_Endpoint.cpp
index fac6270dbb3..45e92f69912 100644
--- a/TAO/tao/Strategies/DIOP_Endpoint.cpp
+++ b/TAO/tao/Strategies/DIOP_Endpoint.cpp
@@ -22,7 +22,7 @@ TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const ACE_INET_Addr &addr,
host_ (),
port_ (0),
object_addr_ (addr),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
this->set (addr, use_dotted_decimal_addresses);
@@ -35,7 +35,7 @@ TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (addr),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
@@ -47,7 +47,7 @@ TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (void)
host_ (),
port_ (0),
object_addr_ (),
- /* hint_ (0), */
+ object_addr_set_ (0),
next_ (0)
{
}
@@ -59,13 +59,12 @@ TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (),
- /* hint_ (0),*/
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
this->host_ = host;
- this->object_addr_.set_type (-1);
this->priority (priority);
}
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.h b/TAO/tao/Strategies/DIOP_Endpoint.h
index 5f9adb0ca31..c9f95f0eedb 100644
--- a/TAO/tao/Strategies/DIOP_Endpoint.h
+++ b/TAO/tao/Strategies/DIOP_Endpoint.h
@@ -133,6 +133,9 @@ private:
/// invocations, etc.
ACE_INET_Addr object_addr_;
+ /// Flag to indicate if the address has been resolved and set.
+ int object_addr_set_;
+
/// DIOP Endpoints can be stringed into a list. Return the next
/// endpoint in the list, if any.
TAO_DIOP_Endpoint *next_;
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.i b/TAO/tao/Strategies/DIOP_Endpoint.i
index 4bfdf5bc838..acdaaad50b5 100644
--- a/TAO/tao/Strategies/DIOP_Endpoint.i
+++ b/TAO/tao/Strategies/DIOP_Endpoint.i
@@ -11,7 +11,7 @@ TAO_DIOP_Endpoint::object_addr (void) const
// ...etc..
// Double checked locking optimization.
- if (this->object_addr_.get_type () != AF_INET)
+ if (!this->object_addr_set_)
{
// We need to modify the object_addr_ in this method. Do so
// using a non-const copy of the <this> pointer.
@@ -24,18 +24,25 @@ TAO_DIOP_Endpoint::object_addr (void) const
endpoint->addr_lookup_lock_,
this->object_addr_ );
- if (this->object_addr_.get_type () != AF_INET
- && endpoint->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
+ if (!this->object_addr_set_)
{
- // If this call fails, it most likely due a hostname lookup
- // failure caused by a DNS misconfiguration. If a request is
- // made to the object at the given host and port, then a
- // CORBA::TRANSIENT() exception should be thrown.
-
- // Invalidate the ACE_INET_Addr. This is used as a flag to
- // denote that ACE_INET_Addr initialization failed.
- endpoint->object_addr_.set_type (-1);
+ if (endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+ else
+ {
+ endpoint->object_addr_set_ = 1;
+ }
}
}
return this->object_addr_;
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.cpp b/TAO/tao/Strategies/SHMIOP_Endpoint.cpp
index ad826bc9b4c..28e74cf69a9 100644
--- a/TAO/tao/Strategies/SHMIOP_Endpoint.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.cpp
@@ -21,6 +21,7 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_MEM_Addr &addr,
host_ (),
port_ (0),
object_addr_ (addr.get_remote_addr ()),
+ object_addr_set_ (0),
next_ (0)
{
this->set (addr.get_remote_addr (), use_dotted_decimal_addresses);
@@ -32,6 +33,7 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr,
host_ (),
port_ (0),
object_addr_ (addr),
+ object_addr_set_ (0),
next_ (0)
{
this->set (addr, use_dotted_decimal_addresses);
@@ -44,6 +46,7 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (addr),
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
@@ -55,6 +58,7 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (void)
host_ (),
port_ (0),
object_addr_ (),
+ object_addr_set_ (0),
next_ (0)
{
}
@@ -66,12 +70,12 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const char *host,
host_ (),
port_ (port),
object_addr_ (),
+ object_addr_set_ (0),
next_ (0)
{
if (host != 0)
this->host_ = host;
- this->object_addr_.set_type (-1);
this->priority (priority);
}
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.h b/TAO/tao/Strategies/SHMIOP_Endpoint.h
index f19cabbfd8a..efdf29708d6 100644
--- a/TAO/tao/Strategies/SHMIOP_Endpoint.h
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.h
@@ -129,6 +129,9 @@ private:
/// invocations, etc.
ACE_INET_Addr object_addr_;
+ /// Flag to indicate if the address has been resolved and set.
+ int object_addr_set_;
+
/// SHMIOP Endpoints can be stringed into a list. Return the next
/// endpoint in the list, if any.
TAO_SHMIOP_Endpoint *next_;
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.i b/TAO/tao/Strategies/SHMIOP_Endpoint.i
index fc0fdd772b0..c37e12aaebd 100644
--- a/TAO/tao/Strategies/SHMIOP_Endpoint.i
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.i
@@ -11,7 +11,7 @@ TAO_SHMIOP_Endpoint::object_addr (void) const
// ...etc..
// Double checked locking optimization.
- if (this->object_addr_.get_type () != AF_INET)
+ if (!this->object_addr_set_)
{
// We need to modify the object_addr_ in this method. Do so
// using a non-const copy of the <this> pointer.
@@ -24,18 +24,25 @@ TAO_SHMIOP_Endpoint::object_addr (void) const
endpoint->addr_lookup_lock_,
this->object_addr_ );
- if (this->object_addr_.get_type () != AF_INET
- && endpoint->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
+ if (!this->object_addr_set_)
{
- // If this call fails, it most likely due a hostname lookup
- // failure caused by a DNS misconfiguration. If a request is
- // made to the object at the given host and port, then a
- // CORBA::TRANSIENT() exception should be thrown.
-
- // Invalidate the ACE_INET_Addr. This is used as a flag to
- // denote that ACE_INET_Addr initialization failed.
- endpoint->object_addr_.set_type (-1);
+ if (endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+ else
+ {
+ endpoint->object_addr_set_ = 1;
+ }
}
}
diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp
index 68ab8203f9a..335a0e75c9c 100644
--- a/TAO/tao/Transport.cpp
+++ b/TAO/tao/Transport.cpp
@@ -1244,11 +1244,22 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh,
// Align the message block
ACE_CDR::mb_align (&message_block);
+ size_t recv_size = 0;
+ if (this->orb_core_->orb_params ()->single_read_optimization ())
+ {
+ recv_size =
+ message_block.space ();
+ }
+ else
+ {
+ recv_size =
+ this->messaging_object ()->header_length ();
+ }
// Read the message into the message block that we have created on
// the stack.
ssize_t n = this->recv (message_block.rd_ptr (),
- message_block.space (),
+ recv_size,
max_wait_time);
// If there is an error return to the reactor..
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
index 9869b50f2a5..d0e56191dc9 100644
--- a/TAO/tao/params.cpp
+++ b/TAO/tao/params.cpp
@@ -23,7 +23,8 @@ TAO_ORB_Parameters::TAO_ORB_Parameters (void)
use_dotted_decimal_addresses_ (0),
std_profile_components_ (1),
sched_policy_ (THR_SCHED_DEFAULT),
- scope_policy_ (THR_SCOPE_PROCESS)
+ scope_policy_ (THR_SCOPE_PROCESS),
+ single_read_optimization_ (1)
{
for (int i = 0; i <= TAO_NO_OF_MCAST_SERVICES; ++i)
this->service_port_[i] = 0;
diff --git a/TAO/tao/params.h b/TAO/tao/params.h
index 2e7639cbde4..f0f8d226a8f 100644
--- a/TAO/tao/params.h
+++ b/TAO/tao/params.h
@@ -145,6 +145,10 @@ public:
long scope_policy (void) const;
void scope_policy (long x);
+ /// Single read optimization.
+ int single_read_optimization (void) const;
+ void single_read_optimization (int x);
+
private:
// Each "endpoint" is of the form:
//
@@ -210,6 +214,9 @@ private:
/// Thread scope policy.
long scope_policy_;
+
+ /// Single read optimization.
+ int single_read_optimization_;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/params.i b/TAO/tao/params.i
index c2adb51d536..fa5d9d315e7 100644
--- a/TAO/tao/params.i
+++ b/TAO/tao/params.i
@@ -171,6 +171,18 @@ TAO_ORB_Parameters::scope_policy (long x)
this->scope_policy_ = x;
}
+ACE_INLINE int
+TAO_ORB_Parameters::single_read_optimization (void) const
+{
+ return this->single_read_optimization_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::single_read_optimization (int x)
+{
+ this->single_read_optimization_ = x;
+}
+
#if 0