summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-03 13:44:58 +0000
committerbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-03 13:44:58 +0000
commiteaae1adadaecb79610101bbeafdab01d9d1cf0df (patch)
tree5797fe2502521c77e99e21c18a3fd7782aacd41a
parentb0ee74e95b503cdd01455fd5bc90cde9eed8ab12 (diff)
downloadATCD-eaae1adadaecb79610101bbeafdab01d9d1cf0df.tar.gz
ChangeLogTag:Sun Oct 3 13:38:01 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog34
-rw-r--r--TAO/tao/Connection_Handler.cpp15
-rw-r--r--TAO/tao/Transport.h10
-rw-r--r--TAO/tao/Transport.inl7
-rw-r--r--TAO/tao/Wait_On_LF_No_Upcall.cpp13
-rw-r--r--TAO/tao/Wait_On_LF_No_Upcall.h2
-rw-r--r--TAO/tao/Wait_On_Leader_Follower.cpp10
-rw-r--r--TAO/tao/Wait_On_Leader_Follower.h1
-rw-r--r--TAO/tao/Wait_On_Reactor.cpp14
-rw-r--r--TAO/tao/Wait_On_Reactor.h1
-rw-r--r--TAO/tao/Wait_On_Read.cpp11
-rw-r--r--TAO/tao/Wait_On_Read.h1
-rw-r--r--TAO/tao/Wait_Strategy.h10
13 files changed, 92 insertions, 37 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 7f837ad428d..84edf9287f5 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,37 @@
+Sun Oct 3 13:38:01 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * tao/Wait_Strategy.h:
+
+ Added a new pure virtual method, can_process_upcalls ().
+
+ * tao/Wait_On_LF_No_Upcall.cpp:
+ * tao/Wait_On_LF_No_Upcall.h:
+ * tao/Wait_On_Leader_Follower.cpp:
+ * tao/Wait_On_Leader_Follower.h:
+ * tao/Wait_On_Reactor.cpp:
+ * tao/Wait_On_Reactor.h:
+ * tao/Wait_On_Read.cpp:
+ * tao/Wait_On_Read.h:
+
+ Implementation for can_process_upcalls (). This method returns
+ true for all the Wait strategies but for
+ Wait_On_LF_No_Upcall. Only the Wait_On_LF_No_Upcall returns
+ false since the semantics of the class are so.
+
+ * tao/Connection_Handler.cpp:
+
+ Use the can_process_upcalls () in handle_input_eh () instead of
+ the checks in place there. This check invariably resulted in a
+ TSS access which seem to slow down things quite a bit. This was
+ based on my profiler. I am not sure whether this is going to
+ show up any conclusive results in our stat pages.
+
+ * tao/Transport.h:
+ * tao/Transport.inl:
+
+ Removed the acts_as_server () call since the functionality is
+ replaced by the new pure virtual method in Wait_Strategy.
+
Sat Oct 2 17:03:42 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* tao/PortableServer/Default_Policy_Validator.cpp:
diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp
index fdfe3ef99e6..d8616c49558 100644
--- a/TAO/tao/Connection_Handler.cpp
+++ b/TAO/tao/Connection_Handler.cpp
@@ -211,14 +211,9 @@ int
TAO_Connection_Handler::handle_input_eh (
ACE_HANDLE h, ACE_Event_Handler *eh)
{
- if (this->transport ()->acts_as_server () &&
- this->orb_core_->get_tss_resources ()->upcalls_temporarily_suspended_on_this_thread_)
+ // If we can't process upcalls just return
+ if (!this->transport ()->wait_strategy ()->can_process_upcalls ())
{
-#if 0 // DON'T IMPLEMENT YET, BUT RECORD THE IDEA FOR POSTERITY
- // ACE_Time_Value this->spin_prevention_backoff_delay_;
- ACE_OS::usleep (this->spin_prevention_backoff_delay_);
- this->spin_prevention_backoff_delay_ = 2 * this->spin_prevention_backoff_delay_ + 1;
-#endif
if (TAO_debug_level > 6)
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Connection_Handler[%d] - not going to handle_input "
@@ -229,12 +224,8 @@ TAO_Connection_Handler::handle_input_eh (
return 0;
}
-#if 0
- this->spin_prevention_backoff_delay_ = 0;
-#endif
-
int result = this->handle_input_internal (h, eh);
-
+
if (result == -1)
{
this->close_connection ();
diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h
index e02f53e25ea..ff9e669037d 100644
--- a/TAO/tao/Transport.h
+++ b/TAO/tao/Transport.h
@@ -298,16 +298,6 @@ public:
TAO::Connection_Role opened_as (void) const;
void opened_as (TAO::Connection_Role);
- /**
- * Predicate that returns true if it is valid for this transport to act in a server
- * role. This would, for example, be true if opened_as() == TAO_SERVER_ROLE
- * or bidirectional_flag() == 1.
- *
- * \return 0 cannot act in server role
- * \return 1 can acts in server role
- */
- bool acts_as_server (void) const;
-
/// Get and Set the purging order. The purging strategy uses the set
/// version to set the purging order.
unsigned long purging_order (void) const;
diff --git a/TAO/tao/Transport.inl b/TAO/tao/Transport.inl
index be8b82bdac1..7b90286f074 100644
--- a/TAO/tao/Transport.inl
+++ b/TAO/tao/Transport.inl
@@ -50,13 +50,6 @@ TAO_Transport::opened_as (TAO::Connection_Role role)
this->opening_connection_role_ = role;
}
-ACE_INLINE bool
-TAO_Transport::acts_as_server (void) const
-{
- return (this->opened_as () == TAO::TAO_SERVER_ROLE ||
- this->bidirectional_flag_ == 1) ? true : false;
-}
-
ACE_INLINE TAO_Transport_Cache_Manager::HASH_MAP_ENTRY *
TAO_Transport::cache_map_entry (void)
{
diff --git a/TAO/tao/Wait_On_LF_No_Upcall.cpp b/TAO/tao/Wait_On_LF_No_Upcall.cpp
index 539d3cfe76d..cf06846b4e2 100644
--- a/TAO/tao/Wait_On_LF_No_Upcall.cpp
+++ b/TAO/tao/Wait_On_LF_No_Upcall.cpp
@@ -85,4 +85,17 @@ namespace TAO
return base::wait (max_wait_time, rd);
}
+ bool
+ Wait_On_LF_No_Upcall::can_process_upcalls (void) const
+ {
+ TAO_ORB_Core_TSS_Resources *tss =
+ this->transport_->orb_core()->get_tss_resources ();
+
+ if ((this->transport_->opened_as () == TAO::TAO_CLIENT_ROLE) &&
+ (this->transport_->bidirectional_flag () == 0) &&
+ (tss->upcalls_temporarily_suspended_on_this_thread_ == true))
+ return false;
+
+ return true;
+ }
}
diff --git a/TAO/tao/Wait_On_LF_No_Upcall.h b/TAO/tao/Wait_On_LF_No_Upcall.h
index 2c6c452f655..bfc9f56640e 100644
--- a/TAO/tao/Wait_On_LF_No_Upcall.h
+++ b/TAO/tao/Wait_On_LF_No_Upcall.h
@@ -50,6 +50,8 @@ namespace TAO
virtual int wait (ACE_Time_Value *max_wait_time,
TAO_Synch_Reply_Dispatcher &rd);
+
+ virtual bool can_process_upcalls (void) const;
};
}
#include /**/ "ace/post.h"
diff --git a/TAO/tao/Wait_On_Leader_Follower.cpp b/TAO/tao/Wait_On_Leader_Follower.cpp
index 71b7009bd78..062e75e4805 100644
--- a/TAO/tao/Wait_On_Leader_Follower.cpp
+++ b/TAO/tao/Wait_On_Leader_Follower.cpp
@@ -6,8 +6,8 @@
#include "tao/Transport.h"
#include "tao/Synch_Reply_Dispatcher.h"
-ACE_RCSID (tao,
- Wait_On_Leader_Follower,
+ACE_RCSID (tao,
+ Wait_On_Leader_Follower,
"$Id$")
TAO_Wait_On_Leader_Follower::TAO_Wait_On_Leader_Follower (TAO_Transport *transport)
@@ -61,3 +61,9 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
this->transport_,
max_wait_time);
}
+
+bool
+TAO_Wait_On_Leader_Follower::can_process_upcalls (void) const
+{
+ return true;
+}
diff --git a/TAO/tao/Wait_On_Leader_Follower.h b/TAO/tao/Wait_On_Leader_Follower.h
index 2ccf6c066fa..1093187b28e 100644
--- a/TAO/tao/Wait_On_Leader_Follower.h
+++ b/TAO/tao/Wait_On_Leader_Follower.h
@@ -52,6 +52,7 @@ public:
TAO_Synch_Reply_Dispatcher &rd);
virtual int register_handler (void);
virtual int non_blocking (void);
+ virtual bool can_process_upcalls (void) const;
};
#include /**/ "ace/post.h"
diff --git a/TAO/tao/Wait_On_Reactor.cpp b/TAO/tao/Wait_On_Reactor.cpp
index 25e8a21c8f9..818a8e045c7 100644
--- a/TAO/tao/Wait_On_Reactor.cpp
+++ b/TAO/tao/Wait_On_Reactor.cpp
@@ -7,8 +7,8 @@
#include "ace/Reactor.h"
-ACE_RCSID (tao,
- Wait_On_Reactor,
+ACE_RCSID (tao,
+ Wait_On_Reactor,
"$Id$")
TAO_Wait_On_Reactor::TAO_Wait_On_Reactor (TAO_Transport *transport)
@@ -48,8 +48,8 @@ TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time,
}
// Did we timeout? If so, stop running the loop.
- if (result == 0
- && max_wait_time != 0
+ if (result == 0
+ && max_wait_time != 0
&& *max_wait_time == ACE_Time_Value::zero)
{
break;
@@ -108,3 +108,9 @@ TAO_Wait_On_Reactor::non_blocking (void)
{
return 1;
}
+
+bool
+TAO_Wait_On_Reactor::can_process_upcalls (void) const
+{
+ return true;
+}
diff --git a/TAO/tao/Wait_On_Reactor.h b/TAO/tao/Wait_On_Reactor.h
index 58b1508584e..08d4e8788c2 100644
--- a/TAO/tao/Wait_On_Reactor.h
+++ b/TAO/tao/Wait_On_Reactor.h
@@ -44,6 +44,7 @@ public:
TAO_Synch_Reply_Dispatcher &rd);
virtual int register_handler (void);
virtual int non_blocking (void);
+ virtual bool can_process_upcalls (void) const;
};
#include /**/ "ace/post.h"
diff --git a/TAO/tao/Wait_On_Read.cpp b/TAO/tao/Wait_On_Read.cpp
index b1bff062486..3239ba392cc 100644
--- a/TAO/tao/Wait_On_Read.cpp
+++ b/TAO/tao/Wait_On_Read.cpp
@@ -5,8 +5,8 @@
#include "tao/Resume_Handle.h"
#include "tao/Synch_Reply_Dispatcher.h"
-ACE_RCSID (tao,
- Wait_On_Read,
+ACE_RCSID (tao,
+ Wait_On_Read,
"$Id$")
// Constructor.
@@ -80,3 +80,10 @@ TAO_Wait_On_Read::non_blocking (void)
{
return 0;
}
+
+bool
+TAO_Wait_On_Read::can_process_upcalls (void) const
+{
+ // Just don't think twice..
+ return true;
+}
diff --git a/TAO/tao/Wait_On_Read.h b/TAO/tao/Wait_On_Read.h
index 37a7fd032b3..f3a7aa609aa 100644
--- a/TAO/tao/Wait_On_Read.h
+++ b/TAO/tao/Wait_On_Read.h
@@ -43,6 +43,7 @@ public:
TAO_Synch_Reply_Dispatcher &rd);
virtual int register_handler (void);
virtual int non_blocking (void);
+ virtual bool can_process_upcalls (void) const;
};
#include /**/ "ace/post.h"
diff --git a/TAO/tao/Wait_Strategy.h b/TAO/tao/Wait_Strategy.h
index 1dbce84b49b..bd41faebd2d 100644
--- a/TAO/tao/Wait_Strategy.h
+++ b/TAO/tao/Wait_Strategy.h
@@ -63,6 +63,16 @@ public:
/// the socket on which it is waiting to non-blocking mode or not.
virtual int non_blocking (void) = 0;
+ /// Flag that indicates whether we can process requests while
+ /// waiting for the reply.
+ /**
+ * This flag is to check whether the thread can process upcalls
+ * while waiting for the reply. Some wait strategies, like
+ * Wait_On_LF_No_Upcall does not allow the client threads to process
+ * requests while waiting for the reply.
+ */
+ virtual bool can_process_upcalls (void) const = 0;
+
/// Get method for the flag
int is_registered (void);