summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-11-12 08:57:55 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-11-12 08:57:55 +0000
commit89cdcc3cda27b8615449f01d7f1e9190734cce54 (patch)
tree61369590e2f8aeedce2c5a66d1110e7af9d6db09 /TAO/tao
parentc060defb6cd92a1fd02a65496c88c652b56c19af (diff)
downloadATCD-89cdcc3cda27b8615449f01d7f1e9190734cce54.tar.gz
Mon Nov 12 08:54:21 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.cpp22
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.h9
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp9
-rw-r--r--TAO/tao/Invocation_Adapter.cpp49
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation.cpp44
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp14
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp3
-rw-r--r--TAO/tao/Remote_Invocation.cpp8
-rw-r--r--TAO/tao/Remote_Invocation.h3
-rw-r--r--TAO/tao/Synch_Invocation.cpp61
-rw-r--r--TAO/tao/Synch_Invocation.h3
-rw-r--r--TAO/tao/TransportCurrent/IIOP_Current_Impl.cpp4
-rw-r--r--TAO/tao/Utils/ORB_Manager.cpp4
13 files changed, 143 insertions, 90 deletions
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.cpp b/TAO/tao/DynamicInterface/DII_Invocation.cpp
index 1c24576d764..99a4c46358b 100644
--- a/TAO/tao/DynamicInterface/DII_Invocation.cpp
+++ b/TAO/tao/DynamicInterface/DII_Invocation.cpp
@@ -17,6 +17,8 @@
#include "tao/Profile_Transport_Resolver.h"
#include "tao/ORB_Constants.h"
#include "tao/SystemException.h"
+#include "tao/Transport.h"
+#include "tao/GIOP_Message_Base.h"
#include "ace/OS_NS_string.h"
@@ -83,6 +85,15 @@ namespace TAO
return Synch_Twoway_Invocation::remote_twoway (max_wait_time);
}
+ void
+ DII_Invocation::transport_resolved (void)
+ {
+ Synch_Twoway_Invocation::transport_resolved ();
+
+ this->resolver_.transport ()->messaging_object ()->out_stream ().reset_byte_order (
+ host_->_tao_byte_order ());
+ }
+
Invocation_Status
DII_Invocation::handle_user_exception (TAO_InputCDR &cdr)
{
@@ -207,9 +218,18 @@ namespace TAO
Invocation_Status
DII_Deferred_Invocation::remote_invocation (ACE_Time_Value *max_wait_time)
{
+ return Asynch_Remote_Invocation::remote_invocation (max_wait_time);
+ }
+
+ void
+ DII_Deferred_Invocation::transport_resolved (void)
+ {
+ Asynch_Remote_Invocation::transport_resolved ();
+
this->safe_rd_->transport (this->resolver_.transport ());
- return Asynch_Remote_Invocation::remote_invocation (max_wait_time);
+ this->resolver_.transport ()->messaging_object ()->out_stream ().reset_byte_order (
+ host_->_tao_byte_order ());
}
}
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.h b/TAO/tao/DynamicInterface/DII_Invocation.h
index 373d6058500..93abab1f579 100644
--- a/TAO/tao/DynamicInterface/DII_Invocation.h
+++ b/TAO/tao/DynamicInterface/DII_Invocation.h
@@ -60,6 +60,10 @@ namespace TAO
Invocation_Status remote_invocation (ACE_Time_Value *max_wait_time);
virtual Invocation_Status handle_user_exception (TAO_InputCDR &cdr);
+
+ protected:
+ virtual void transport_resolved (void);
+
private:
CORBA::ExceptionList *excp_list_;
@@ -88,11 +92,12 @@ namespace TAO
Invocation_Status remote_invocation (ACE_Time_Value *max_wait_time);
- private:
+ protected:
+ virtual void transport_resolved (void);
+ private:
/// Back pointer to the DII request that created us.
CORBA::Request_ptr host_;
-
};
/**
diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp
index 744ff1a11f8..a0c44b8d5ef 100644
--- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp
+++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp
@@ -9,8 +9,6 @@
#include "tao/ORB_Constants.h"
#include "tao/Profile_Transport_Resolver.h"
#include "tao/Transport.h"
-#include "tao/Transport.h"
-#include "tao/GIOP_Message_Base.h"
#include "tao/SystemException.h"
#include "tao/operation_details.h"
@@ -87,16 +85,12 @@ namespace TAO
CORBA::COMPLETED_NO);
}
- r.transport ()->messaging_object ()->out_stream ().reset_byte_order (
- request_->_tao_byte_order ());
-
TAO::DII_Invocation synch (this->target_,
r,
op,
this->exception_list_,
this->request_);
-
Invocation_Status status = synch.remote_invocation (max_wait_time);
if (status == TAO_INVOKE_RESTART && synch.is_forwarded ())
@@ -194,7 +188,6 @@ namespace TAO
CORBA::COMPLETED_NO);
}
- r.transport ()->messaging_object ()->out_stream ().reset_byte_order (request_->_tao_byte_order ());
TAO::DII_Deferred_Invocation synch (
this->target_,
r,
@@ -202,8 +195,6 @@ namespace TAO
this->rd_,
this->request_);
- r.transport ()->messaging_object ()->out_stream ().reset_byte_order (request_->_tao_byte_order ());
-
Invocation_Status status = synch.remote_invocation (max_wait_time);
if (status == TAO_INVOKE_RESTART)
diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp
index 8375055e311..26f124c23d2 100644
--- a/TAO/tao/Invocation_Adapter.cpp
+++ b/TAO/tao/Invocation_Adapter.cpp
@@ -9,7 +9,6 @@
#include "tao/debug.h"
#include "tao/Collocated_Invocation.h"
#include "tao/Transport.h"
-#include "tao/Transport_Mux_Strategy.h"
#include "tao/Collocation_Proxy_Broker.h"
#include "tao/GIOP_Utils.h"
#include "tao/TAOC.h"
@@ -67,8 +66,7 @@ namespace TAO
// Initial state
TAO::Invocation_Status status = TAO_INVOKE_START;
- while (status == TAO_INVOKE_START ||
- status == TAO_INVOKE_RESTART)
+ while (status == TAO_INVOKE_START || status == TAO_INVOKE_RESTART)
{
// Default we go to remote
Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY;
@@ -232,7 +230,7 @@ namespace TAO
(void) this->set_response_flags (stub, details);
- CORBA::Octet rflags = details.response_flags ();
+ CORBA::Octet const rflags = details.response_flags ();
bool const block_connect =
rflags != static_cast<CORBA::Octet> (Messaging::SYNC_NONE)
&& rflags != static_cast<CORBA::Octet> (TAO::SYNC_DELAYED_BUFFERING);
@@ -244,35 +242,24 @@ namespace TAO
stub,
block_connect);
- resolver.resolve (max_wait_time);
-
- if (TAO_debug_level)
+ switch (this->type_)
{
- if (is_timeout && *max_wait_time == ACE_Time_Value::zero)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t)Invocation_Adapter::invoke_remote_i: ")
- ACE_TEXT ("max wait time consumed during transport resolution\n")));
- }
-
-
- // Update the request id now that we have a transport
- details.request_id (resolver.transport ()->tms ()->request_id ());
+ case TAO_ONEWAY_INVOCATION:
+ {
+ return this->invoke_oneway (details,
+ effective_target,
+ resolver,
+ max_wait_time);
+ }
+ case TAO_TWOWAY_INVOCATION:
+ {
+ return this->invoke_twoway (details,
+ effective_target,
+ resolver,
+ max_wait_time);
- if (this->type_ == TAO_ONEWAY_INVOCATION)
- {
- return this->invoke_oneway (details,
- effective_target,
- resolver,
- max_wait_time);
- }
- else if (this->type_ == TAO_TWOWAY_INVOCATION)
- {
- return this->invoke_twoway (details,
- effective_target,
- resolver,
- max_wait_time);
+ }
}
-
return TAO_INVOKE_FAILURE;
}
@@ -370,8 +357,6 @@ namespace TAO
TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
errno),
CORBA::COMPLETED_NO);
-
- return;
}
} // End namespace TAO
diff --git a/TAO/tao/Messaging/Asynch_Invocation.cpp b/TAO/tao/Messaging/Asynch_Invocation.cpp
index ef635284df1..77a13a3ca5c 100644
--- a/TAO/tao/Messaging/Asynch_Invocation.cpp
+++ b/TAO/tao/Messaging/Asynch_Invocation.cpp
@@ -41,12 +41,6 @@ namespace TAO
Invocation_Status
Asynch_Remote_Invocation::remote_invocation (ACE_Time_Value *max_wait_time)
{
- TAO_Target_Specification tspec;
- this->init_target_spec (tspec);
-
- TAO_OutputCDR & cdr =
- this->resolver_.transport ()->messaging_object ()->out_stream ();
-
Invocation_Status s = TAO_INVOKE_FAILURE;
#if TAO_HAS_INTERCEPTORS == 1
@@ -61,6 +55,38 @@ namespace TAO
try
{
#endif /* TAO_HAS_INTERCEPTORS */
+ bool const is_timeout = max_wait_time && (*max_wait_time != ACE_Time_Value::zero);
+
+ this->resolver_.resolve (max_wait_time);
+
+ if (TAO_debug_level)
+ {
+ if (is_timeout && max_wait_time && *max_wait_time == ACE_Time_Value::zero)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Asynch_Remote_Invocation::remote_invocation: ")
+ ACE_TEXT ("max wait time consumed during transport resolution\n")));
+ }
+
+ // Callback that the transport has been resolved. Derived classes
+ // can now use the transport if they need to
+ this->transport_resolved ();
+
+ TAO_Transport* const transport = this->resolver_.transport ();
+
+ if (this->safe_rd_.get ())
+ {
+ this->safe_rd_->transport (transport);
+ // AMI Timeout Handling Begin
+ ACE_Time_Value tmp;
+
+ if (is_timeout)
+ {
+ this->safe_rd_->schedule_timer (this->details_.request_id (), *max_wait_time);
+ }
+ }
+
+ TAO_OutputCDR & cdr =
+ this->resolver_.transport ()->messaging_object ()->out_stream ();
// Oneway semantics. See comments for below send_message()
// call.
@@ -69,7 +95,7 @@ namespace TAO
TAO_Transport::TAO_ONEWAY_REQUEST,
max_wait_time);
- this->write_header (tspec, cdr);
+ this->write_header (cdr);
this->marshal_data (cdr);
@@ -78,7 +104,7 @@ namespace TAO
TAO_Bind_Dispatcher_Guard dispatch_guard (
this->details_.request_id (),
this->safe_rd_.get (),
- this->resolver_.transport ()->tms ());
+ transport->tms ());
// Now that we have bound the reply dispatcher to the map, just
// loose ownership of the reply dispatcher.
@@ -132,7 +158,7 @@ namespace TAO
// NOTE: Not sure how things are handles with exclusive muxed
// strategy.
- if (this->resolver_.transport ()->idle_after_send ())
+ if (transport->idle_after_send ())
(void) this->resolver_.transport_released ();
#if TAO_HAS_INTERCEPTORS == 1
diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
index b52785566d8..3a26fdc8744 100644
--- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
+++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
@@ -170,20 +170,6 @@ namespace TAO
CORBA::COMPLETED_NO);
}
- if (this->safe_rd_.get ())
- {
- // Cache the transport in the reply dispatcher
- this->safe_rd_->transport (r.transport ());
-
- // AMI Timeout Handling Begin
- ACE_Time_Value tmp;
-
- if (this->get_timeout (r.stub (), tmp))
- {
- this->safe_rd_->schedule_timer (op.request_id (), *max_wait_time);
- }
- }
-
// Loose ownership of the reply dispatcher
TAO::Asynch_Remote_Invocation asynch (
effective_target.in (),
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp
index 78b973c67fb..6dffcaa45b2 100644
--- a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp
@@ -60,8 +60,7 @@ namespace TAO
CORBA::Object_ptr
ObjectReferenceTemplate::make_object (
const char *,
- const PortableInterceptor::ObjectId &
- )
+ const PortableInterceptor::ObjectId &)
{
if (CORBA::is_nil (this->poa_.in ()))
throw ::CORBA::BAD_INV_ORDER ();
diff --git a/TAO/tao/Remote_Invocation.cpp b/TAO/tao/Remote_Invocation.cpp
index 8659724739e..87c5e625f9d 100644
--- a/TAO/tao/Remote_Invocation.cpp
+++ b/TAO/tao/Remote_Invocation.cpp
@@ -99,9 +99,11 @@ namespace TAO
}
void
- Remote_Invocation::write_header (TAO_Target_Specification &spec,
- TAO_OutputCDR &out_stream)
+ Remote_Invocation::write_header (TAO_OutputCDR &out_stream)
{
+ TAO_Target_Specification spec;
+ this->init_target_spec (spec);
+
this->resolver_.transport ()->clear_translators (0, &out_stream);
// Send the request for the header
@@ -142,7 +144,7 @@ namespace TAO
if (nph != 0)
{
// nph = 0, means DiffServ library is not used
- // nph = 0, means DiffServ library is used, and
+ // nph = 0, means DiffServ library is used, and
// request DSCP and reply DSCP are set.
// Note that the application could still be using
// RTCORBA, but still setting DIffServ codepoints
diff --git a/TAO/tao/Remote_Invocation.h b/TAO/tao/Remote_Invocation.h
index ce45b946d6b..c274471b421 100644
--- a/TAO/tao/Remote_Invocation.h
+++ b/TAO/tao/Remote_Invocation.h
@@ -68,8 +68,7 @@ namespace TAO
void init_target_spec (TAO_Target_Specification &spec);
/// Write the GIOP header into the stream.
- void write_header (TAO_Target_Specification &spec,
- TAO_OutputCDR &out_stream);
+ void write_header (TAO_OutputCDR &out_stream);
/// Marshal the arguments into the stream.
void marshal_data (TAO_OutputCDR &cdr);
diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp
index 2031d848c2d..15fe92b4e4d 100644
--- a/TAO/tao/Synch_Invocation.cpp
+++ b/TAO/tao/Synch_Invocation.cpp
@@ -15,6 +15,7 @@
#include "tao/ORB_Core.h"
#include "tao/Service_Context.h"
#include "tao/SystemException.h"
+#include "tao/Transport_Mux_Strategy.h"
#if TAO_HAS_INTERCEPTORS == 1
# include "tao/PortableInterceptorC.h"
@@ -58,9 +59,6 @@ namespace TAO
TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (),
this->details_.reply_service_info ());
- TAO_Target_Specification tspec;
- this->init_target_spec (tspec);
-
Invocation_Status s = TAO_INVOKE_FAILURE;
#if TAO_HAS_INTERCEPTORS == 1
@@ -76,15 +74,32 @@ namespace TAO
try
{
#endif /*TAO_HAS_INTERCEPTORS */
+ bool const is_timeout = max_wait_time && (*max_wait_time != ACE_Time_Value::zero);
+
+ this->resolver_.resolve (max_wait_time);
+
+ if (TAO_debug_level)
+ {
+ if (is_timeout && max_wait_time && *max_wait_time == ACE_Time_Value::zero)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Synch_Oneway_Invocation::remote_twoway: ")
+ ACE_TEXT ("max wait time consumed during transport resolution\n")));
+ }
- TAO_OutputCDR &cdr = this->resolver_.transport ()->out_stream ();
+ // Callback that the transport has been resolved. Derived classes
+ // can now use the transport if they need to
+ this->transport_resolved ();
+
+ TAO_Transport* const transport = this->resolver_.transport ();
+
+ TAO_OutputCDR &cdr = transport->out_stream ();
cdr.message_attributes (this->details_.request_id (),
this->resolver_.stub (),
TAO_Transport::TAO_TWOWAY_REQUEST,
max_wait_time);
- this->write_header (tspec, cdr);
+ this->write_header (cdr);
this->marshal_data (cdr);
@@ -93,13 +108,13 @@ namespace TAO
TAO_Bind_Dispatcher_Guard dispatch_guard (
this->details_.request_id (),
&rd,
- this->resolver_.transport ()->tms ());
+ transport->tms ());
if (dispatch_guard.status () != 0)
{
// @@ What is the right way to handle this error? Why should
// we close the connection?
- this->resolver_.transport ()->close_connection ();
+ transport->close_connection ();
throw ::CORBA::INTERNAL (0, CORBA::COMPLETED_NO);
}
@@ -132,7 +147,7 @@ namespace TAO
// For some strategies one may want to release the transport
// back to cache. If the idling is successfull let the
// resolver about that.
- if (this->resolver_.transport ()->idle_after_send ())
+ if (transport->idle_after_send ())
this->resolver_.transport_released ();
// @@ In all MT environments, there's a cancellation point lurking
@@ -175,7 +190,7 @@ namespace TAO
// For some strategies one may want to release the transport
// back to cache after receiving the reply.
- if (this->resolver_.transport ()->idle_after_reply ())
+ if (transport->idle_after_reply ())
this->resolver_.transport_released ();
#if TAO_HAS_INTERCEPTORS == 1
@@ -238,7 +253,7 @@ namespace TAO
int const reply_error =
this->resolver_.transport ()->wait_strategy ()->wait (max_wait_time, rd);
- if (TAO_debug_level > 0 && max_wait_time != 0)
+ if (TAO_debug_level > 0 && max_wait_time)
{
CORBA::ULong const msecs = max_wait_time->msec ();
@@ -595,6 +610,12 @@ namespace TAO
return TAO_INVOKE_SYSTEM_EXCEPTION;
}
+ void Synch_Twoway_Invocation::transport_resolved (void)
+ {
+ // Update the request id now that we have a transport
+ this->details_.request_id (this->resolver_.transport ()->tms ()->request_id ());
+ }
+
// =========================================================================
Synch_Oneway_Invocation::Synch_Oneway_Invocation (
@@ -622,9 +643,6 @@ namespace TAO
return s;
}
- TAO_Target_Specification tspec;
- this->init_target_spec (tspec);
-
#if TAO_HAS_INTERCEPTORS == 1
s = this->send_request_interception ();
@@ -634,6 +652,21 @@ namespace TAO
try
{
#endif /*TAO_HAS_INTERCEPTORS */
+ bool const is_timeout = max_wait_time && (*max_wait_time != ACE_Time_Value::zero);
+
+ this->resolver_.resolve (max_wait_time);
+
+ if (TAO_debug_level)
+ {
+ if (is_timeout && max_wait_time && *max_wait_time == ACE_Time_Value::zero)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Synch_Oneway_Invocation::remote_oneway: ")
+ ACE_TEXT ("max wait time consumed during transport resolution\n")));
+ }
+
+ // Callback that the transport has been resolved. Derived classes
+ // can now use the transport if they need to
+ this->transport_resolved ();
TAO_Transport* const transport = this->resolver_.transport ();
@@ -644,7 +677,7 @@ namespace TAO
TAO_Transport::TAO_ONEWAY_REQUEST,
max_wait_time);
- this->write_header (tspec, cdr);
+ this->write_header (cdr);
this->marshal_data (cdr);
diff --git a/TAO/tao/Synch_Invocation.h b/TAO/tao/Synch_Invocation.h
index 58aa96774c6..b731de9e040 100644
--- a/TAO/tao/Synch_Invocation.h
+++ b/TAO/tao/Synch_Invocation.h
@@ -107,6 +107,9 @@ namespace TAO
TAO_Synch_Reply_Dispatcher &rd,
TAO_Bind_Dispatcher_Guard &bd);
+ /// Callback when the transport resolver has resolved a transport
+ virtual void transport_resolved (void);
+
private:
/// Helper method that checks the reply status of the
diff --git a/TAO/tao/TransportCurrent/IIOP_Current_Impl.cpp b/TAO/tao/TransportCurrent/IIOP_Current_Impl.cpp
index fa49fcf0104..4576c973a22 100644
--- a/TAO/tao/TransportCurrent/IIOP_Current_Impl.cpp
+++ b/TAO/tao/TransportCurrent/IIOP_Current_Impl.cpp
@@ -30,11 +30,11 @@ namespace TAO
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
const TAO_Transport* t = this->transport ();
if (t == 0)
- throw ::CORBA::NO_IMPLEMENT ();
+ throw NoContext ();
TAO_Connection_Handler *ch = const_cast<TAO_Transport*>(t)->connection_handler ();
if (ch == 0)
- throw ::CORBA::NO_IMPLEMENT ();
+ throw NoContext ();
return dynamic_cast <TAO_IIOP_Connection_Handler*> (ch);
#else
diff --git a/TAO/tao/Utils/ORB_Manager.cpp b/TAO/tao/Utils/ORB_Manager.cpp
index 5776a957e1c..4ab7af28e56 100644
--- a/TAO/tao/Utils/ORB_Manager.cpp
+++ b/TAO/tao/Utils/ORB_Manager.cpp
@@ -254,6 +254,10 @@ TAO_ORB_Manager::~TAO_ORB_Manager (void)
{
this->poa_->destroy (1,1);
}
+ if (!CORBA::is_nil (this->orb_.in ()))
+ {
+ this->orb_->destroy ();
+ }
}
catch (const ::CORBA::Exception&)
{