summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-04-10 15:40:11 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-04-10 15:40:11 +0000
commit673b4792f6190e45cc70f1b6bb9722221df343bc (patch)
treeb15927fa8a27e7c84b7a8c8e39a9187a25ad3151
parentb9dc8a6d0a3d38bd54306a1626cf3a88877d95b8 (diff)
downloadATCD-673b4792f6190e45cc70f1b6bb9722221df343bc.tar.gz
ChangeLogTag: Thu Apr 10 10:30x:33 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog30
-rw-r--r--TAO/docs/Options.html47
-rw-r--r--TAO/tao/Client_Strategy_Factory.cpp6
-rw-r--r--TAO/tao/Client_Strategy_Factory.h3
-rw-r--r--TAO/tao/Muxed_TMS.cpp31
-rw-r--r--TAO/tao/Muxed_TMS.h3
-rw-r--r--TAO/tao/Transport_Mux_Strategy.cpp1
-rw-r--r--TAO/tao/Transport_Mux_Strategy.h3
-rw-r--r--TAO/tao/default_client.cpp46
-rw-r--r--TAO/tao/default_client.h4
10 files changed, 148 insertions, 26 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index b5c0ec124b0..cea8efcea5e 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,33 @@
+Thu Apr 10 10:30x:33 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * tao/default_client.cpp:
+ * tao/default_client.h:
+ * tao/Client_Strategy_Factory.cpp:
+ * tao/Client_Strategy_Factory.h: Added a new -ORB option,
+ -ORBTransporMuxStrategyLock, and a accessor
+ create_transport_mux_strategy_lock () that returns the lock
+ created by the strategy factory. The options and the accessor
+ helps the user to use either a locked or a lock free transport
+ muxed strategy. Please see the documentation in
+ docs/Options.html for details on how to use this.
+
+ * tao/Transport_Mux_Strategy.cpp:
+ * tao/Transport_Mux_Strategy.h: Added a lock to the muxed strategy
+ class. The lock will actually be created, and used by the
+ concrete strategies. Looks like the all the concrete strategies
+ may require some type of strategized locking. Hence this has
+ been moved here with a purpose.
+
+ * tao/Muxed_TMS.cpp:
+ * tao/Muxed_TMS.h: Removed the hard coded recursive mutex, and used
+ the strategized lock created by the client strategy factory
+ instead.
+
+ This fixes BUG 1491 and thanks again to Carlos for motivating
+ this change.
+
+ * docs/Options.html: Added documentation for the new options.
+
Thu Apr 10 13:40:02 CEST 2003 Oliver Kellogg <oliver.kellogg@sysde.eads.net>
* orbsvcs/orbsvcs/Event/EC_Default_Factory.cpp:
diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html
index 66d54382822..9a996f211b5 100644
--- a/TAO/docs/Options.html
+++ b/TAO/docs/Options.html
@@ -614,6 +614,22 @@ would load all the options listed within "".
thread until all the data is sent.
</TD>
</TR>
+<TR>
+ <TD><CODE>-ORBResourceUsage</CODE> <EM>eager / lazy</EM></TD>
+ <TD><a name="-ORBResourceUsage"></a>
+ This option, as the name implies is useful for strategizing the
+ resources used byt the ORB. <EM> Eager </EM> resource usage
+ would mean that all the resources are reserved upfront even
+ if they are not used. The <EM> lazy </EM> resource usage on the
+ other hand, tries to allocate or use resources when needed. <p>
+
+ The default for this option is <EM> eager </EM>, and at this
+ point, only the de-marshalling resources for IOR can be
+ controlled using this option. It will not have any effect on
+ other resources that are eagerly used by the ORB. They are work
+ in progress.<p>
+ </TD>
+</TR>
</TABLE>
</P>
</blockquote>
@@ -866,7 +882,6 @@ would load all the options listed within "".
</TD>
</TR>
-
<TR>
<TD><CODE>-ORBTransportMuxStrategy</CODE> <EM>EXCLUSIVE / MUXED</EM></TD>
@@ -886,6 +901,36 @@ would load all the options listed within "".
</TD>
</TR>
<TR>
+ <TD><CODE>-ORBTransportMuxStrategyLock</CODE> <EM>thread / null</EM></TD>
+
+ <TD><A name="-ORBTransportMuxStrategyLock"></a>
+
+ Specify the kind of synchronization primitive for the Muxed
+ strategy. Default is <code>thread</code>, which means that a
+ mutex is used. The type of mutex depends on the muxed strategy
+ in use. The second option is <code>null</code>, which
+ means a null lock is used. This makes sense in case of
+ optimizations and when only a single threaded client
+ is in use. <p>
+
+ Default for this option is <EM> thread </EM>.
+
+ </TD>
+ </TR>
+ <TR>
+ <TD><CODE>-ORBReplyDispatcherTableSize</CODE> <EM>number</EM></TD>
+
+ <TD><A name="-ORBReplyDispatcherTableSize"></a>
+
+ Specify the initial number of entries in the tables used for
+ storing the reply dispatchers. Using a smaller value would
+ limit the amount of runtime memory used. But, if the number of
+ entries exceeds the starting size, dynamic changes in table
+ sizes could incur unpredictability during execution <p>
+ Default for this option is <EM> thread </EM>.
+ </TD>
+ </TR>
+ <TR>
<TD><CODE>-ORBConnectStrategy</CODE> <EM>type</EM></TD>
<TD><a name="-ORBConnectStrategy"></a>
TAO provides three strategies to connect to remote servers.
diff --git a/TAO/tao/Client_Strategy_Factory.cpp b/TAO/tao/Client_Strategy_Factory.cpp
index 9aa411b72a8..59a8ad9a8df 100644
--- a/TAO/tao/Client_Strategy_Factory.cpp
+++ b/TAO/tao/Client_Strategy_Factory.cpp
@@ -24,6 +24,12 @@ TAO_Client_Strategy_Factory::create_transport_mux_strategy (TAO_Transport *)
return 0;
}
+ACE_Lock *
+TAO_Client_Strategy_Factory::create_transport_mux_strategy_lock (void)
+{
+ return 0;
+}
+
int
TAO_Client_Strategy_Factory::reply_dispatcher_table_size (void) const
{
diff --git a/TAO/tao/Client_Strategy_Factory.h b/TAO/tao/Client_Strategy_Factory.h
index cf1da78ab6d..e3b0e54966f 100644
--- a/TAO/tao/Client_Strategy_Factory.h
+++ b/TAO/tao/Client_Strategy_Factory.h
@@ -56,6 +56,9 @@ public:
/// Create the correct client request muxing strategy.
virtual TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport);
+ /// Create the correct lock for request muxing strategy.
+ virtual ACE_Lock *create_transport_mux_strategy_lock (void);
+
/// Return the size of the reply dispatcher table
virtual int reply_dispatcher_table_size (void) const;
diff --git a/TAO/tao/Muxed_TMS.cpp b/TAO/tao/Muxed_TMS.cpp
index f25931a9fef..98baffc0a21 100644
--- a/TAO/tao/Muxed_TMS.cpp
+++ b/TAO/tao/Muxed_TMS.cpp
@@ -14,15 +14,18 @@ ACE_RCSID(tao, Muxed_TMS, "$Id$")
TAO_Muxed_TMS::TAO_Muxed_TMS (TAO_Transport *transport)
- : TAO_Transport_Mux_Strategy (transport),
- request_id_generator_ (0),
- orb_core_ (transport->orb_core ()),
- dispatcher_table_ (TAO_RD_TABLE_SIZE)
+ : TAO_Transport_Mux_Strategy (transport)
+ , request_id_generator_ (0)
+ , orb_core_ (transport->orb_core ())
+ , dispatcher_table_ (this->orb_core_->client_factory ()->reply_dispatcher_table_size ())
{
+ this->lock_ =
+ this->orb_core_->client_factory ()->create_transport_mux_strategy_lock ();
}
TAO_Muxed_TMS::~TAO_Muxed_TMS (void)
{
+ delete this->lock_;
}
// Generate and return an unique request id for the current
@@ -31,8 +34,8 @@ CORBA::ULong
TAO_Muxed_TMS::request_id (void)
{
// @@ What is a good error return value?
- ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon,
- this->lock_, 0);
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon,
+ *this->lock_, 0);
++this->request_id_generator_;
@@ -63,9 +66,9 @@ int
TAO_Muxed_TMS::bind_dispatcher (CORBA::ULong request_id,
TAO_Reply_Dispatcher *rd)
{
- ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ ACE_GUARD_RETURN (ACE_Lock,
ace_mon,
- this->lock_,
+ *this->lock_,
-1);
int result =
@@ -88,9 +91,9 @@ TAO_Muxed_TMS::bind_dispatcher (CORBA::ULong request_id,
int
TAO_Muxed_TMS::unbind_dispatcher (CORBA::ULong request_id)
{
- ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ ACE_GUARD_RETURN (ACE_Lock,
ace_mon,
- this->lock_,
+ *this->lock_,
-1);
TAO_Reply_Dispatcher *rd = 0;
@@ -107,9 +110,9 @@ TAO_Muxed_TMS::dispatch_reply (TAO_Pluggable_Reply_Params &params)
// Grab the reply dispatcher for this id.
{
- ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ ACE_GUARD_RETURN (ACE_Lock,
ace_mon,
- this->lock_,
+ *this->lock_,
-1);
result =
@@ -190,9 +193,9 @@ TAO_Muxed_TMS::idle_after_reply (void)
void
TAO_Muxed_TMS::connection_closed (void)
{
- ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX,
+ ACE_GUARD (ACE_Lock,
ace_mon,
- this->lock_);
+ *this->lock_);
REQUEST_DISPATCHER_TABLE::ITERATOR end =
this->dispatcher_table_.end ();
diff --git a/TAO/tao/Muxed_TMS.h b/TAO/tao/Muxed_TMS.h
index 5b862542812..a2dae4572c7 100644
--- a/TAO/tao/Muxed_TMS.h
+++ b/TAO/tao/Muxed_TMS.h
@@ -64,9 +64,6 @@ public:
virtual void connection_closed (void);
protected:
- /// Lock to protect the state of this class
- TAO_SYNCH_RECURSIVE_MUTEX lock_;
-
/// Used to generate a different request_id on each call to
/// request_id().
CORBA::ULong request_id_generator_;
diff --git a/TAO/tao/Transport_Mux_Strategy.cpp b/TAO/tao/Transport_Mux_Strategy.cpp
index 2997e5c70d8..bf499cf1cd9 100644
--- a/TAO/tao/Transport_Mux_Strategy.cpp
+++ b/TAO/tao/Transport_Mux_Strategy.cpp
@@ -7,6 +7,7 @@ ACE_RCSID(tao, Transport_Mut_Strategy, "$Id$")
TAO_Transport_Mux_Strategy::TAO_Transport_Mux_Strategy (TAO_Transport *transport)
: transport_ (transport)
+ , lock_ (0)
{
}
diff --git a/TAO/tao/Transport_Mux_Strategy.h b/TAO/tao/Transport_Mux_Strategy.h
index a7f27db98e4..744db21fc19 100644
--- a/TAO/tao/Transport_Mux_Strategy.h
+++ b/TAO/tao/Transport_Mux_Strategy.h
@@ -83,6 +83,9 @@ public:
protected:
/// Cache the transport reference.
TAO_Transport *transport_;
+
+ /// Lock to protect the state of the object
+ ACE_Lock *lock_;
};
#include "ace/post.h"
diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp
index b28b021320e..e6957189291 100644
--- a/TAO/tao/default_client.cpp
+++ b/TAO/tao/default_client.cpp
@@ -19,8 +19,9 @@
ACE_RCSID(tao, default_client, "$Id$")
TAO_Default_Client_Strategy_Factory::TAO_Default_Client_Strategy_Factory (void)
- : profile_lock_type_ (TAO_THREAD_LOCK),
- rd_table_size_ (TAO_RD_TABLE_SIZE)
+ : profile_lock_type_ (TAO_THREAD_LOCK)
+ , rd_table_size_ (TAO_RD_TABLE_SIZE)
+ , muxed_strategy_lock_type_ (TAO_THREAD_LOCK)
{
// Use single thread client connection handler
#if defined (TAO_USE_ST_CLIENT_CONNECTION_HANDLER)
@@ -137,6 +138,24 @@ TAO_Default_Client_Strategy_Factory::parse_args (int argc, ACE_TCHAR* argv[])
}
}
else if (ACE_OS::strcmp (argv[curarg],
+ ACE_LIB_TEXT("-ORBTransportMuxStrategyLock")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_LIB_TEXT("null")) == 0)
+ this->muxed_strategy_lock_type_ = TAO_NULL_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_LIB_TEXT("thread")) == 0)
+ this->muxed_strategy_lock_type_ = TAO_THREAD_LOCK;
+ else
+ this->report_option_value_error (ACE_LIB_TEXT("-ORBTransportMuxStrategyLock"), name);
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg],
ACE_LIB_TEXT("-ORBConnectStrategy")) == 0)
{
curarg++;
@@ -205,12 +224,6 @@ TAO_Default_Client_Strategy_Factory::create_profile_lock (void)
return the_lock;
}
-// @@ Alex: implement the WS and TMS methods here, similar to the
-// create_profile_lock above...
-// @@ Alex: remember your idea of using the
-// -ORBclientconnectionhandler option to implement the WS factory,
-// but you need new options for the TMS...
-
// Create the correct client transport muxing strategy.
TAO_Transport_Mux_Strategy *
TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy (TAO_Transport *transport)
@@ -229,6 +242,23 @@ TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy (TAO_Transpor
return tms;
}
+ACE_Lock *
+TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->muxed_strategy_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (),
+ 0);
+
+ return the_lock;
+}
+
int
TAO_Default_Client_Strategy_Factory::reply_dispatcher_table_size (void) const
{
diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h
index 13698ee8156..aa1c4c31c38 100644
--- a/TAO/tao/default_client.h
+++ b/TAO/tao/default_client.h
@@ -52,6 +52,7 @@ public:
// following methods.
virtual ACE_Lock* create_profile_lock (void);
virtual TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport);
+ virtual ACE_Lock *create_transport_mux_strategy_lock (void);
virtual int reply_dispatcher_table_size (void) const;
virtual int allow_callback (void);
virtual TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport);
@@ -103,6 +104,9 @@ private:
/// Size of the reply dispatcher table
int rd_table_size_;
+
+ /// Type of lock for the muxed_strategy
+ Lock_Type muxed_strategy_lock_type_;
};
#if defined (__ACE_INLINE__)