summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Mitz <mitza-oci@users.noreply.github.com>2008-08-25 23:32:27 +0000
committerAdam Mitz <mitza-oci@users.noreply.github.com>2008-08-25 23:32:27 +0000
commit702f038d5fd972a063c8c6854bc3ff3b18dcadaf (patch)
tree7ddda4f7e63a52a891f0130c1222fdf381cd9691
parentadaf90f65f9b6ea8bde03da32cbfa2e48ee77c16 (diff)
downloadATCD-702f038d5fd972a063c8c6854bc3ff3b18dcadaf.tar.gz
ChangeLogTag: Mon Aug 25 22:28:04 UTC 2008 Adam Mitz <mitza@ociweb.com>
-rw-r--r--TAO/ChangeLog34
-rw-r--r--TAO/tao/LF_CH_Event.cpp32
-rw-r--r--TAO/tao/LF_CH_Event.h15
-rw-r--r--TAO/tao/LF_Event.h2
-rw-r--r--TAO/tao/LF_Event.inl2
-rw-r--r--TAO/tao/LF_Event_Binder.cpp2
-rw-r--r--TAO/tao/LF_Event_Binder.h1
-rw-r--r--TAO/tao/LF_Event_Binder.inl1
-rw-r--r--TAO/tao/LF_Multi_Event.cpp6
-rw-r--r--TAO/tao/LF_Multi_Event.h2
-rw-r--r--TAO/tao/Transport_Connector.cpp1
-rwxr-xr-xTAO/tests/Bug_1361_Regression/run_test.pl4
12 files changed, 91 insertions, 11 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 0680ecbadbe..3e9d454d27a 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,37 @@
+Mon Aug 25 22:28:04 UTC 2008 Adam Mitz <mitza@ociweb.com>
+
+ * tao/LF_Event.h:
+ * tao/LF_Event.inl:
+
+ Allow for multiple followers per event (if derived classes implement
+ this behavior). Specifically, added a "follower" argument to
+ unbind() to match bind().
+
+ * tao/LF_Multi_Event.h:
+ * tao/LF_Multi_Event.cpp:
+
+ Modified for the new unbind() signature.
+
+ * tao/LF_CH_Event.h:
+ * tao/LF_CH_Event.cpp:
+
+ Implement multiple followers using an ACE_Hash_Map_Manager_Ex. This
+ allows multiple threads to wait for a Connection Handler event.
+
+ * tao/LF_Event_Binder.h:
+ * tao/LF_Event_Binder.inl:
+ * tao/LF_Event_Binder.cpp:
+
+ Store the follower pointer so that it can be passed to unbind().
+
+ * tao/Transport_Connector.cpp (wait_for_connection_completion):
+
+ Purge the entry from the cache if the connection fails.
+
+ * tests/Bug_1361_Regression/run_test.pl:
+
+ Add server logging output if -debug is passed.
+
Mon Aug 18 14:03:23 UTC 2008 Ciju John <johnc at ociweb dot com>
* tests/Oneway_Send_Timeouts/run_test.pl:
diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp
index 41304c082bc..c093f41eba2 100644
--- a/TAO/tao/LF_CH_Event.cpp
+++ b/TAO/tao/LF_CH_Event.cpp
@@ -1,4 +1,5 @@
#include "tao/LF_CH_Event.h"
+#include "tao/LF_Follower.h"
ACE_RCSID(tao,
LF_Invocation_Event,
@@ -17,13 +18,38 @@ TAO_LF_CH_Event::~TAO_LF_CH_Event (void)
{
}
+int
+TAO_LF_CH_Event::bind (TAO_LF_Follower *follower)
+{
+ return this->followers_.bind (follower, 0);
+}
+
+int
+TAO_LF_CH_Event::unbind (TAO_LF_Follower *follower)
+{
+ return this->followers_.unbind (follower);
+}
+
void
TAO_LF_CH_Event::state_changed_i (int new_state)
{
- if (this->state_ == new_state)
- return;
+ if (this->state_ != new_state)
+ {
+ this->validate_state_change (new_state);
+ }
+
+ ACE_MT (ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->followers_.mutex ()));
+
+ HASH_MAP::iterator end_it = this->followers_.end ();
+ for (HASH_MAP::iterator it = this->followers_.begin (); it != end_it ; ++it)
+ {
+ it->ext_id_->signal ();
+ }
+}
- // Validate the state change
+void
+TAO_LF_CH_Event::validate_state_change (int new_state)
+{
if (this->state_ == TAO_LF_Event::LFS_IDLE)
{
// From the LFS_IDLE state we can only become active.
diff --git a/TAO/tao/LF_CH_Event.h b/TAO/tao/LF_CH_Event.h
index edf12c72049..69166097bb7 100644
--- a/TAO/tao/LF_CH_Event.h
+++ b/TAO/tao/LF_CH_Event.h
@@ -16,6 +16,10 @@
#include /**/ "ace/pre.h"
#include "tao/LF_Event.h"
+#include "tao/orbconf.h"
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Null_Mutex.h"
+#include "ace/Thread_Mutex.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -108,10 +112,21 @@ private:
/// Set the state irrespective of anything.
virtual void set_state (int new_state);
+ virtual int bind (TAO_LF_Follower *follower);
+ virtual int unbind (TAO_LF_Follower *follower);
+
private:
/// The previous state that the LF_CH_Event was in
int prev_state_;
+
+ void validate_state_change (int new_state);
+
+ typedef ACE_Hash_Map_Manager_Ex <TAO_LF_Follower *, int,
+ ACE_Hash<void *>,
+ ACE_Equal_To<TAO_LF_Follower *>,
+ TAO_SYNCH_MUTEX> HASH_MAP;
+ HASH_MAP followers_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event.h b/TAO/tao/LF_Event.h
index abad06792e1..937a504ae16 100644
--- a/TAO/tao/LF_Event.h
+++ b/TAO/tao/LF_Event.h
@@ -73,7 +73,7 @@ public:
virtual int bind (TAO_LF_Follower *follower);
/// Unbind the follower
- virtual int unbind (void);
+ virtual int unbind (TAO_LF_Follower *follower);
//@{
/** @name State management
diff --git a/TAO/tao/LF_Event.inl b/TAO/tao/LF_Event.inl
index 236c8ea69ac..60ec3ca2cf6 100644
--- a/TAO/tao/LF_Event.inl
+++ b/TAO/tao/LF_Event.inl
@@ -14,7 +14,7 @@ TAO_LF_Event::bind (TAO_LF_Follower *follower)
}
ACE_INLINE int
-TAO_LF_Event::unbind (void)
+TAO_LF_Event::unbind (TAO_LF_Follower *)
{
if (this->follower_ == 0)
return -1;
diff --git a/TAO/tao/LF_Event_Binder.cpp b/TAO/tao/LF_Event_Binder.cpp
index 27fc93c2c5e..6f59f2dd05b 100644
--- a/TAO/tao/LF_Event_Binder.cpp
+++ b/TAO/tao/LF_Event_Binder.cpp
@@ -14,7 +14,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_LF_Event_Binder::~TAO_LF_Event_Binder (void)
{
- this->event_->unbind ();
+ this->event_->unbind (follower_);
}
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event_Binder.h b/TAO/tao/LF_Event_Binder.h
index c2b8ff51498..c2225fac1be 100644
--- a/TAO/tao/LF_Event_Binder.h
+++ b/TAO/tao/LF_Event_Binder.h
@@ -43,6 +43,7 @@ public:
private:
/// Keep a reference to the leader follower
TAO_LF_Event * const event_;
+ TAO_LF_Follower * const follower_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event_Binder.inl b/TAO/tao/LF_Event_Binder.inl
index 14027194f35..6a69f079368 100644
--- a/TAO/tao/LF_Event_Binder.inl
+++ b/TAO/tao/LF_Event_Binder.inl
@@ -8,6 +8,7 @@ ACE_INLINE
TAO_LF_Event_Binder::TAO_LF_Event_Binder (TAO_LF_Event *event,
TAO_LF_Follower *follower)
: event_ (event)
+ , follower_ (follower)
{
this->event_->bind (follower);
}
diff --git a/TAO/tao/LF_Multi_Event.cpp b/TAO/tao/LF_Multi_Event.cpp
index bd1e5e2e88f..fa55eeeaefd 100644
--- a/TAO/tao/LF_Multi_Event.cpp
+++ b/TAO/tao/LF_Multi_Event.cpp
@@ -43,15 +43,15 @@ TAO_LF_Multi_Event::bind (TAO_LF_Follower *follower)
}
int
-TAO_LF_Multi_Event::unbind (void)
+TAO_LF_Multi_Event::unbind (TAO_LF_Follower *follower)
{
- if (this->TAO_LF_Event::unbind() == -1)
+ if (this->TAO_LF_Event::unbind (follower) == -1)
{
return -1;
}
for (Event_Node *n = this->events_; n != 0; n = n->next_)
- if (n->ptr_->unbind() == -1)
+ if (n->ptr_->unbind (follower) == -1)
{
return -1;
}
diff --git a/TAO/tao/LF_Multi_Event.h b/TAO/tao/LF_Multi_Event.h
index 5d2167db55b..2a0a05fd9dd 100644
--- a/TAO/tao/LF_Multi_Event.h
+++ b/TAO/tao/LF_Multi_Event.h
@@ -49,7 +49,7 @@ public:
virtual int bind (TAO_LF_Follower *follower);
/// Unbind the follower from all the collected events.
- virtual int unbind (void);
+ virtual int unbind (TAO_LF_Follower *follower);
/// Adds a handler to the collection
void add_event (TAO_Connection_Handler *ch);
diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp
index 33abb9dd062..af155e47496 100644
--- a/TAO/tao/Transport_Connector.cpp
+++ b/TAO/tao/Transport_Connector.cpp
@@ -815,6 +815,7 @@ TAO_Connector::wait_for_connection_completion (
}
else
{
+ transport->purge_entry ();
// The wait failed for some other reason.
// Report that making the connection failed, don't print errno
// because we touched the reactor and errno could be changed
diff --git a/TAO/tests/Bug_1361_Regression/run_test.pl b/TAO/tests/Bug_1361_Regression/run_test.pl
index 5c3c7329bfe..1f964b3e4d2 100755
--- a/TAO/tests/Bug_1361_Regression/run_test.pl
+++ b/TAO/tests/Bug_1361_Regression/run_test.pl
@@ -14,10 +14,12 @@ $iorfile = PerlACE::LocalFile ("$iorfilebase");
unlink $iorfile;
$debug_opts = '';
+$srv_debug = '';
foreach $i (@ARGV) {
if ($i eq '-debug') {
$debug_opts = '-ORBDebugLevel 10 -ORBVerboseLogging 1 '
. '-ORBLogFile client';
+ $srv_debug = '-ORBDebugLevel 10 -ORBVerboseLogging 1';
}
}
@@ -25,7 +27,7 @@ if (PerlACE::is_vxworks_test()) {
$SV = new PerlACE::ProcessVX ("server", "-o $iorfilebase");
}
else {
- $SV = new PerlACE::Process ("server", "-o $iorfile");
+ $SV = new PerlACE::Process ("server", "-o $iorfile $srv_debug");
}
$threads = int (rand() * 6) + 1;
$CL = new PerlACE::Process ("client", "-k file://$iorfile -t $threads $debug_opts");