summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-01-14 17:20:18 +0000
committermbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-01-14 17:20:18 +0000
commit20b2c0ded297cbd405123df34c1c31fe55c01064 (patch)
tree52b74309108834de22451c2345be1c8531997e5d
parentab328773ce26bcc9f066c94d6abac3e752dbf2ae (diff)
downloadATCD-20b2c0ded297cbd405123df34c1c31fe55c01064.tar.gz
ChangeLogTag: Fri Jan 14 18:15:21 2005 Marek Brudka <mbrudka@aster.pl>
-rw-r--r--TAO/ChangeLog16
-rw-r--r--TAO/tao/Leader_Follower.cpp4
-rw-r--r--TAO/tao/ORB_Core.cpp29
-rw-r--r--TAO/tao/ORB_Core.h24
-rw-r--r--TAO/tao/Strategies/advanced_resource.cpp86
-rw-r--r--TAO/tao/Strategies/advanced_resource.h20
-rw-r--r--TAO/tao/qt_resource.cpp4
-rw-r--r--TAO/tao/qt_resource_loader.cpp8
-rw-r--r--TAO/tao/qt_resource_loader.h4
-rwxr-xr-xTAO/tests/QtTests/client.cpp2
-rwxr-xr-xTAO/tests/QtTests/server.cpp2
11 files changed, 83 insertions, 116 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index a899c0f267e..104c22ae532 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,19 @@
+Fri Jan 14 18:15:21 2005 Marek Brudka <mbrudka@aster.pl>
+
+ * tests/QtTests/server.cpp (Module):
+ * tests/QtTests/client.cpp (Module):
+ * tao/Strategies/advanced_resource.h (Module):
+ * tao/Strategies/advanced_resource.cpp (Module):
+ * tao/qt_resource_loader.h (Module):
+ * tao/qt_resource_loader.cpp (Module):
+ * tao/qt_resource.cpp (Module):
+ * tao/ORB_Core.h (Module):
+ * tao/ORB_Core.cpp (Module):
+ * tao/Leader_Follower.cpp (Module):
+ Created reactor factory on ORB_Core level to create GUI reactors.
+ Removed resouce_factory chain from Advanced_Resource_Factory.
+ Adapted qt_resource_loader to new reactor creation schema. Some style changes.
+
Tue Jan 11 23:39:37 2005 Marek Brudka <mbrudka@aster.pl>
* tao/Strategies/advanced_resource.h (Module):
diff --git a/TAO/tao/Leader_Follower.cpp b/TAO/tao/Leader_Follower.cpp
index 308f613abd8..96213cfccca 100644
--- a/TAO/tao/Leader_Follower.cpp
+++ b/TAO/tao/Leader_Follower.cpp
@@ -27,7 +27,7 @@ TAO_Leader_Follower::~TAO_Leader_Follower (void)
delete follower;
}
// Hand the reactor back to the resource factory.
- this->orb_core_->resource_factory ()->reclaim_reactor (this->reactor_);
+ this->orb_core_->reactor_factory ()->reclaim_reactor (this->reactor_);
this->reactor_ = 0;
}
@@ -117,7 +117,7 @@ TAO_Leader_Follower::reactor (void)
if (this->reactor_ == 0)
{
this->reactor_ =
- this->orb_core_->resource_factory ()->get_reactor ();
+ this->orb_core_->reactor_factory ()->get_reactor ();
}
}
return this->reactor_;
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 46be618d904..daff155c95b 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -104,6 +104,7 @@ TAO_ORB_Core_Static_Resources::TAO_ORB_Core_Static_Resources (void)
collocation_resolver_name_ ("Default_Collocation_Resolver"),
stub_factory_name_ ("Default_Stub_Factory"),
resource_factory_name_ ("Resource_Factory"),
+ reactor_factory_name_ (""),
dynamic_adapter_name_ ("Dynamic_Adapter"),
ifr_client_adapter_name_ ("IFR_Client_Adapter"),
typecodefactory_adapter_name_ ("TypeCodeFactory_Adapter"),
@@ -138,6 +139,7 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid)
object_key_table_ (),
orbid_ (ACE_OS::strdup (orbid ? orbid : "")),
resource_factory_ (0),
+ reactor_factory_ (0),
// server_id_ (0),
client_factory_ (0),
server_factory_ (0),
@@ -1222,6 +1224,13 @@ TAO_ORB_Core::set_resource_factory (const char *resource_factory_name)
}
void
+TAO_ORB_Core::set_reactor_factory (const char *reactor_factory_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->reactor_factory_name_ =
+ reactor_factory_name;
+}
+
+void
TAO_ORB_Core::dynamic_adapter_name (const char *name)
{
TAO_ORB_Core_Static_Resources::instance ()->dynamic_adapter_name_ = name;
@@ -1298,6 +1307,26 @@ TAO_ORB_Core::resource_factory (void)
return this->resource_factory_;
}
+TAO_Resource_Factory *
+TAO_ORB_Core::reactor_factory (void)
+{
+ if ( TAO_ORB_Core_Static_Resources::instance ()->reactor_factory_name_== "" )
+ return resource_factory( );
+ // Check if there is a cached reference.
+ if (this->reactor_factory_ != 0)
+ {
+ return this->reactor_factory_;
+ }
+
+ // Look in the service repository for an instance.
+ this->reactor_factory_ =
+ ACE_Dynamic_Service<TAO_Resource_Factory>::instance
+ (TAO_ORB_Core_Static_Resources::instance ()->reactor_factory_name_.c_str());
+
+ return this->reactor_factory_;
+}
+
+
TAO_Thread_Lane_Resources_Manager &
TAO_ORB_Core::thread_lane_resources_manager (void)
{
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index 54330c25851..6d909aedfbb 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -293,7 +293,7 @@ public:
* No-Collocation is a special case of collocation.
*/
static
- TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object
+TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object
ACE_ENV_ARG_DECL);
//@}
@@ -375,6 +375,9 @@ public:
/// Returns pointer to the resource factory.
TAO_Resource_Factory *resource_factory (void);
+ /// Returns pointer to the factory for creating reactor
+ TAO_Resource_Factory *reactor_factory (void);
+
/// Returns pointer to the client factory.
TAO_Client_Strategy_Factory *client_factory (void);
@@ -412,6 +415,9 @@ public:
/// Sets the value of TAO_ORB_Core::resource_factory_
static void set_resource_factory (const char *resource_factory_name);
+ /// Sets the value of TAO_ORB_Core::reactor_resource_factory_
+ static void set_reactor_factory (const char *reactor_resource_factory_name);
+
/// Sets the value of TAO_ORB_Core::protocols_hooks_
static void set_protocols_hooks (const char *protocols_hooks_name);
@@ -430,6 +436,9 @@ public:
/// Gets the value of TAO_ORB_Core::protocols_hooks__
TAO_Protocols_Hooks * get_protocols_hooks (void);
+ /// return the reactor created from reactor_factory or resource_factory
+ ACE_Reactor * get_reactor (void);
+
/// Sets the value of TAO_ORB_Core::dynamic_adapter_name_.
static void dynamic_adapter_name (const char *name);
@@ -460,6 +469,7 @@ public:
/// Gets the value of TAO_ORB_Core::valuetype_adapter_name.
static const char *valuetype_adapter_name (void);
+
/// See if we have a collocated address, if yes, return the POA
/// associated with the address.
int is_collocated (const TAO_MProfile& mprofile);
@@ -1151,6 +1161,9 @@ protected:
/// Handle to the factory for resource information..
TAO_Resource_Factory *resource_factory_;
+ /// Handle to the factory for creating reactor
+ TAO_Resource_Factory *reactor_factory_;
+
#if 0
/// @@todo All these need to go!
/// The allocators for the message blocks
@@ -1400,6 +1413,15 @@ public:
ACE_CString resource_factory_name_;
/**
+ * Name of the factory for creating reactor.
+ * The default value is "", which means that reactor should be created using ordinary
+ * resource factory . If this name is set, then reactor is created using this factory
+ * instead of resource_factory. If reactor_factory fails to create reactor, then
+ * resource_factor is enforced to create reactor.
+ */
+ ACE_CString reactor_factory_name_;
+
+ /**
* Name of the service object for DII request creation that needs
* to be instantiated. The default value is "Dynamic_Adaper". If
* TAO_DynamicInterface is linked, dynamic_adapter_name() will be
diff --git a/TAO/tao/Strategies/advanced_resource.cpp b/TAO/tao/Strategies/advanced_resource.cpp
index 7c1ded566d0..b666d8091c4 100644
--- a/TAO/tao/Strategies/advanced_resource.cpp
+++ b/TAO/tao/Strategies/advanced_resource.cpp
@@ -40,13 +40,8 @@
ACE_RCSID(Strategies, advanced_resource, "$Id$")
-ACE_TCHAR *TAO_Advanced_Resource_Factory::overloaded_resource_factory_name_ = 0;
-
TAO_Resource_Factory_Changer::TAO_Resource_Factory_Changer (void)
{
- // remember the name of overloaded resource factory
- TAO_Advanced_Resource_Factory::overloaded_resource_factory_name(
- TAO_ORB_Core_Static_Resources::instance( )->resource_factory_name_.rep( ) );
TAO_ORB_Core::set_resource_factory ("Advanced_Resource_Factory");
ACE_Service_Config::process_directive (ace_svc_desc_TAO_Advanced_Resource_Factory);
@@ -70,7 +65,7 @@ TAO_Resource_Factory_Changer::TAO_Resource_Factory_Changer (void)
}
TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory (void)
- : reactor_type_ (TAO_REACTOR_UNDEFINED),
+ : reactor_type_ (TAO_REACTOR_TP),
threadqueue_type_ (TAO_THREAD_QUEUE_NOT_SET),
cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK),
amh_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK),
@@ -91,12 +86,6 @@ TAO_Advanced_Resource_Factory::~TAO_Advanced_Resource_Factory (void)
delete *iterator;
this->protocol_factories_.reset ();
-// For some unknown reason Advanced_Resource_Feactory is destroyed the allocate_reactor_impl is called
-// if ( overloaded_resource_factory_name_ )
-// {
-// ACE_OS_Memory::free( overloaded_resource_factory_name_ );
-// overloaded_resource_factory_name_ = 0;
-// }
}
int
@@ -115,10 +104,6 @@ TAO_Advanced_Resource_Factory::init (int argc, ACE_TCHAR** argv)
}
this->options_processed_ = 1;
- // remember the name of overloaded resource factory if
- // different from Advanced_Resource_Factory and Resource_Factory
- TAO_Advanced_Resource_Factory::overloaded_resource_factory_name(
- TAO_ORB_Core_Static_Resources::instance( )->resource_factory_name_.rep( ) );
// If the default resource factory exists, then disable it.
// This causes any directives for the "Resource_Factory" to
@@ -322,10 +307,6 @@ TAO_Advanced_Resource_Factory::load_default_protocols (void)
int
TAO_Advanced_Resource_Factory::init_protocol_factories (void)
{
- // remember the name of overloaded resource factory if
- // different from Advanced_Resource_Factory and Resource_Factory
- TAO_Advanced_Resource_Factory::overloaded_resource_factory_name(
- TAO_ORB_Core_Static_Resources::instance( )->resource_factory_name_.rep( ) );
// If the default resource factory exists, then disable it.
// This causes any directives for the "Resource_Factory" to
@@ -649,33 +630,6 @@ TAO_Advanced_Resource_Factory::get_protocol_factories (void)
}
ACE_Reactor_Impl *
-TAO_Advanced_Resource_Factory::allocate_reactor_from_overloaded_resource_factory ( ) const
-{
- ACE_Reactor_Impl *impl = 0;
- if ( overloaded_resource_factory_name_ ) // an factory was overloaded
- {
- /// create or recall the overloaded factory
- TAO_Default_Resource_Factory *default_resource_factory =
- ACE_Dynamic_Service<TAO_Default_Resource_Factory>::instance( overloaded_resource_factory_name_ );
-
- if ( default_resource_factory )
- {
- /// use reactor from overloaded factory
- ACE_Reactor *reactor = default_resource_factory->get_reactor( );
- // try to upcast ACE_Reactor to obtain implementation, if failed impl is still 0
- if ( reactor )
- {
- ACE_DEBUG ( ( LM_DEBUG,
- ACE_TEXT("Created reactor implementation using Resource_Factory %s\n"),
- overloaded_resource_factory_name_ ) );
- impl = reactor->implementation( );
- }
- }
- }
- return impl;
-}
-
-ACE_Reactor_Impl *
TAO_Advanced_Resource_Factory::allocate_reactor_impl (void) const
{
ACE_Reactor_Impl *impl = 0;
@@ -713,6 +667,7 @@ TAO_Advanced_Resource_Factory::allocate_reactor_impl (void) const
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
break;
+ default:
case TAO_REACTOR_TP:
ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
(ACE_Timer_Queue*)0,
@@ -722,18 +677,6 @@ TAO_Advanced_Resource_Factory::allocate_reactor_impl (void) const
ACE_Select_Reactor_Token::LIFO),
0);
break;
- case TAO_REACTOR_UNDEFINED:
- default:
- impl = allocate_reactor_from_overloaded_resource_factory ( );
- if ( !impl ) // no reactor from overloaded resource factory? Create TP_Reactor (default)
- ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
- (ACE_Timer_Queue*)0,
- this->reactor_mask_signals_,
- this->threadqueue_type_ == TAO_THREAD_QUEUE_FIFO ?
- ACE_Select_Reactor_Token::FIFO :
- ACE_Select_Reactor_Token::LIFO),
- 0);
- break;
}
return impl;
@@ -931,31 +874,6 @@ TAO_Advanced_Resource_Factory::report_unsupported_error (
option_name));
}
-
-void
-TAO_Advanced_Resource_Factory::overloaded_resource_factory_name( const ACE_CString &name )
-{
- if ( name != ACE_TEXT( "" ) &&
- name != ACE_TEXT( "Advanced_Resource_Factory" ) &&
- name != ACE_TEXT( "Resource_Factory" ) )
- {
- if ( overloaded_resource_factory_name_ )
- {
- if ( name != ACE_CString( ACE_TEXT( overloaded_resource_factory_name_ ) ) )
- {
- ACE_ERROR ( ( LM_WARNING, "Resource factory %s overloaded by %s.\n",
- overloaded_resource_factory_name_, name.rep( ) ) );
- }
- ACE_OS_Memory::free( overloaded_resource_factory_name_ );
- }
- overloaded_resource_factory_name_ = ACE_OS::strdup( name.rep( ) );
-
- ACE_DEBUG ( ( LM_DEBUG, "Advanced_Resource_Factory overloaded %s .\n",
- overloaded_resource_factory_name_ ) );
- }
-}
-
-
// ****************************************************************
ACE_STATIC_SVC_DEFINE (TAO_Advanced_Resource_Factory,
diff --git a/TAO/tao/Strategies/advanced_resource.h b/TAO/tao/Strategies/advanced_resource.h
index 06c941435c2..3a8c14bcd02 100644
--- a/TAO/tao/Strategies/advanced_resource.h
+++ b/TAO/tao/Strategies/advanced_resource.h
@@ -32,15 +32,6 @@ public:
* stored in thread-specific storage, stored in shared memory,
* etc.
*
- * Advanced_Resource_Factory may overload previous ORB::resource_factory eg. default Resource_Factory or
- * any other. In the later case Advanced_Resource_Factory tries to remember the name of the overloaded
- * Resource_Factory in order to create the reactor implementation using overloaded factory.
- *
- * The creation of reactor from overloaded factories is handled as follows:
- * - reactor set up by ORBReactorType option turns off any other implementation,
- * - if reactor was not set up by -ORBReactorType, then Advanced_Resource_Fatory tries to
- * allocate reactor using overloaded Resource_Factory.
- * - if the above fail, then the default ACE_TpReactor is created.
*/
class TAO_Strategies_Export TAO_Advanced_Resource_Factory : public TAO_Default_Resource_Factory
{
@@ -74,8 +65,6 @@ public:
TAO_REACTOR_WFMO = 3,
TAO_REACTOR_MSGWFMO = 4 ,
TAO_REACTOR_TP = 5,
- /// undefined falls back into TP if there were no reactor provided by overloaded resource factory
- TAO_REACTOR_UNDEFINED = 0
};
/// Thread queueing Strategy
@@ -107,7 +96,7 @@ public:
virtual TAO_Connection_Purging_Strategy *create_purging_strategy (void);
virtual TAO_LF_Strategy *create_lf_strategy (void);
- static void overloaded_resource_factory_name( const ACE_CString &name );
+
protected:
/// Obtain the reactor implementation
@@ -142,13 +131,6 @@ protected:
virtual int load_default_protocols (void);
-private:
-
- /// create reactor from overloaded resource factory (if any), or return 0
- ACE_Reactor_Impl *allocate_reactor_from_overloaded_resource_factory ( ) const;
-
- /// the name of Resource_Factory overloaded by Advanced_Resource_Factory
- static ACE_TCHAR *overloaded_resource_factory_name_;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/qt_resource.cpp b/TAO/tao/qt_resource.cpp
index fd3cc8af37d..0ce73c42e95 100644
--- a/TAO/tao/qt_resource.cpp
+++ b/TAO/tao/qt_resource.cpp
@@ -15,10 +15,10 @@ TAO_QtResource_Factory::allocate_reactor_impl (void) const
return 0;
if ( !reactor_impl_ )
{
- ACE_NEW_RETURN(reactor_impl_,
+ ACE_NEW_RETURN (reactor_impl_,
ACE_QtReactor (qapp_),
0);
- ACE_DEBUG ( ( LM_DEBUG, "ACE_QtReactor created.\n" ) );
+ ACE_DEBUG ((LM_DEBUG, "ACE_QtReactor created.\n"));
}
return reactor_impl_;
}
diff --git a/TAO/tao/qt_resource_loader.cpp b/TAO/tao/qt_resource_loader.cpp
index f834909d6e8..471f4fec34e 100644
--- a/TAO/tao/qt_resource_loader.cpp
+++ b/TAO/tao/qt_resource_loader.cpp
@@ -7,13 +7,13 @@
// Must be called with lock held
-TAO_QtResource_Loader::TAO_QtResource_Loader ( QApplication *qapp )
+TAO_QtResource_Loader::TAO_QtResource_Loader (QApplication *qapp)
{
- TAO_ORB_Core::set_resource_factory ( "QtResource_Factory" );
+ TAO_ORB_Core::set_reactor_factory ("QtResource_Factory");
ACE_Service_Config::process_directive (ace_svc_desc_TAO_QtResource_Factory);
- TAO_QtResource_Factory::set_context ( qapp );
+ TAO_QtResource_Factory::set_context (qapp);
}
-TAO_QtResource_Loader::~TAO_QtResource_Loader ( )
+TAO_QtResource_Loader::~TAO_QtResource_Loader ()
{
}
diff --git a/TAO/tao/qt_resource_loader.h b/TAO/tao/qt_resource_loader.h
index 84db359e3ad..6482cdaf5b4 100644
--- a/TAO/tao/qt_resource_loader.h
+++ b/TAO/tao/qt_resource_loader.h
@@ -36,8 +36,8 @@ class TAO_QtReactor_Export TAO_QtResource_Loader
{
public:
- TAO_QtResource_Loader ( QApplication *qapp = 0 );
- virtual ~TAO_QtResource_Loader( );
+ TAO_QtResource_Loader (QApplication *qapp=0);
+ virtual ~TAO_QtResource_Loader ();
};
#include /**/ "ace/post.h"
diff --git a/TAO/tests/QtTests/client.cpp b/TAO/tests/QtTests/client.cpp
index d09a82e1b64..5453b33d85c 100755
--- a/TAO/tests/QtTests/client.cpp
+++ b/TAO/tests/QtTests/client.cpp
@@ -12,7 +12,7 @@ int
main (int argc, char *argv[])
{
QApplication app (argc, argv);
- TAO_QtResource_Loader qt_resources( &app );
+ TAO_QtResource_Loader qt_resources (&app);
ACE_DECLARE_NEW_CORBA_ENV;
diff --git a/TAO/tests/QtTests/server.cpp b/TAO/tests/QtTests/server.cpp
index 52b337b5681..1fccab81a3e 100755
--- a/TAO/tests/QtTests/server.cpp
+++ b/TAO/tests/QtTests/server.cpp
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
// Qt specific stuff for running with TAO...
QApplication app (argc, argv);
- TAO_QtResource_Loader qt_resources( &app );
+ TAO_QtResource_Loader qt_resources (&app);
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY