diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-17 04:06:49 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-17 04:06:49 +0000 |
commit | edee2e3915ab299c90abfd24db8647d175d826d3 (patch) | |
tree | 1cc3af3b96dd607c54981a90aa1d7ee673b098da /TAO/tao | |
parent | 55ce42757438892716f64bf6dfba3da033b3c061 (diff) | |
download | ATCD-edee2e3915ab299c90abfd24db8647d175d826d3.tar.gz |
ChangeLogTag:Fri Jul 16 22:39:15 1999 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Acceptor_Impl.cpp | 48 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Impl.h | 62 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Impl.i | 25 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.cpp | 38 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.h | 16 | ||||
-rw-r--r-- | TAO/tao/UIOP_Acceptor.cpp | 39 | ||||
-rw-r--r-- | TAO/tao/UIOP_Acceptor.h | 8 |
7 files changed, 135 insertions, 101 deletions
diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index f7d35cfaddd..9feaafd5597 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -33,41 +33,35 @@ ACE_RCSID(tao, Acceptor_Impl, "$Id$") -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (TAO_ORB_Core* orb_core, - const ACE_PEER_ACCEPTOR_ADDR &local_address, - int flags, - int use_select, - int reuse_addr) +template <class SVC_HANDLER> +TAO_Creation_Strategy<SVC_HANDLER>::TAO_Creation_Strategy (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core) { - this->orb_core_ = orb_core; - return this->ACE_Acceptor<SVC_HANDLER,ACE_PEER_ACCEPTOR_2>::open - (local_address, - this->orb_core_->reactor (), - flags, - use_select, - reuse_addr); } -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (SVC_HANDLER *&sh) +template <class SVC_HANDLER> int +TAO_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) { if (sh == 0) - { - if (this->orb_core_ == 0) - this->orb_core_ = TAO_ORB_Core_instance (); - - ACE_NEW_RETURN (sh, - SVC_HANDLER (this->orb_core_), - -1); - } + ACE_NEW_RETURN (sh, + SVC_HANDLER (this->orb_core_), + -1); + return 0; } -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (SVC_HANDLER *sh) +template <class SVC_HANDLER> +TAO_Concurrency_Strategy<SVC_HANDLER>::TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core) +{ +} + + +template <class SVC_HANDLER> int +TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, + void *arg) { - if (this->ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (sh) == -1) + if (this->ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh) == -1) return -1; TAO_Server_Strategy_Factory *f = @@ -77,7 +71,7 @@ TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (SVC_H return sh->activate (f->server_connection_thread_flags (), f->server_connection_thread_count ()); - return this->reactor ()->register_handler + return this->orb_core_->reactor ()->register_handler (sh, ACE_Event_Handler::READ_MASK); } diff --git a/TAO/tao/Acceptor_Impl.h b/TAO/tao/Acceptor_Impl.h index de100f75f2d..81bd0085389 100644 --- a/TAO/tao/Acceptor_Impl.h +++ b/TAO/tao/Acceptor_Impl.h @@ -24,49 +24,41 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -template<class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> class TAO_Acceptor_Impl : public ACE_Acceptor<SVC_HANDLER,ACE_PEER_ACCEPTOR_2> +template <class SVC_HANDLER> +class TAO_Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER> { // = TITLE - // Helper class to implement the acceptors in TAO - // - // = DESCRIPTION - // TAO pluggable protocols framework provide an abstraction to - // represent any kind of acceptor object, the implementation of - // that acceptor is left for the pluggable protocol implementor, - // but the most common case would be to use an ACE_Acceptor<> - // instantiated over the right Svc_Handlers. - // But the Svc_Handlers must inherit the <orb_core> that owns the - // acceptor, though this could be implemented in each pluggable - // protocol we believe that this class would simplify that task - // and work in most cases. Pluggable protocol implementors are, - // of course, free to use something else. - // + // Creates a Svc_Handler and set the ORB_Core pointer on it. public: - // = Initialization and termination methods. - TAO_Acceptor_Impl (ACE_Reactor * = 0, - int use_select = 1); + TAO_Creation_Strategy (TAO_ORB_Core *orb_core); // Constructor. - TAO_Acceptor_Impl (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Reactor::instance (), - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - // The constructors, just delegate to the base class. - - int open (TAO_ORB_Core* orb_core, - const ACE_PEER_ACCEPTOR_ADDR &, - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - // Initialize the ORB_Core. + int make_svc_handler (SVC_HANDLER *&sh); + // Create a SVC_HANDLER and set the ORB_Core pointer on it. protected: - // = See $ACE_ROOT/ace/Acceptor.h for the documentation. - virtual int make_svc_handler (SVC_HANDLER *&sh); - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + TAO_ORB_Core *orb_core_; + // Pointer to the ORB Core. +}; -private: +template <class SVC_HANDLER> +class TAO_Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> +{ + // = TITLE + // Activates the Svc_Handler, and then if specified by the + // TAO_Server_Strategy_Factory, it activates the Svc_Handler to + // run in its own thread. +public: + TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core); + // Constructor. + + int activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg); + // Activates the Svc_Handler, and then if specified by the + // TAO_Server_Strategy_Factory, it activates the Svc_Handler to run + // in its own thread. + +protected: TAO_ORB_Core *orb_core_; // Pointer to the ORB Core. }; diff --git a/TAO/tao/Acceptor_Impl.i b/TAO/tao/Acceptor_Impl.i index 7cafd44c6d7..cfa1da318d3 100644 --- a/TAO/tao/Acceptor_Impl.i +++ b/TAO/tao/Acceptor_Impl.i @@ -1,26 +1 @@ // $Id$ - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_INLINE -TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>:: - TAO_Acceptor_Impl (ACE_Reactor *reactor, - int use_select) - : ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> (reactor, use_select), - orb_core_ (0) -{ -} - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_INLINE -TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>:: - TAO_Acceptor_Impl (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * reactor, - int flags, - int use_select, - int reuse_addr) - : ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> (local_addr, - reactor, - flags, - use_select, - reuse_addr), - orb_core_ (0) -{ -} diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index bde9b999deb..761fb623229 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -32,11 +32,19 @@ ACE_RCSID(tao, IIOP_Acceptor, "$Id$") TAO_IIOP_Acceptor::TAO_IIOP_Acceptor (void) : TAO_Acceptor (TAO_IOP_TAG_INTERNET_IOP), base_acceptor_ (), + creation_strategy_ (0), + concurrency_strategy_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0) { } +TAO_IIOP_Acceptor::~TAO_IIOP_Acceptor (void) +{ + delete this->creation_strategy_; + delete this->concurrency_strategy_; +} + // TODO = // 2) For V1.[1,2] there are tagged components // 3) Create multiple profiles for wild carded endpoints (may be multiple @@ -142,7 +150,19 @@ TAO_IIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, { this->orb_core_ = orb_core; - if (this->base_acceptor_.open (orb_core, addr) == -1) + ACE_NEW_RETURN (this->creation_strategy_, + TAO_IIOP_CREATION_STRATEGY (this->orb_core_), + -1); + + ACE_NEW_RETURN (this->concurrency_strategy_, + TAO_IIOP_CONCURRENCY_STRATEGY (this->orb_core_), + -1); + + if (this->base_acceptor_.open (addr, + this->orb_core_->reactor (), + this->creation_strategy_, + 0, + this->concurrency_strategy_) == -1) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -212,11 +232,23 @@ TAO_IIOP_Acceptor::endpoint_count (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Acceptor<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; -template class TAO_Acceptor_Impl<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Strategy_Acceptor<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Accept_Strategy<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Creation_Strategy<TAO_IIOP_Server_Connection_Handler>; +template class ACE_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler>; +template class ACE_Scheduling_Strategy<TAO_IIOP_Server_Connection_Handler>; +template class TAO_Creation_Strategy<TAO_IIOP_Server_Connection_Handler>; +template class TAO_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Acceptor<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> -#pragma instantiate TAO_Acceptor_Impl<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Strategy_Acceptor<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<TAO_IIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Creation_Strategy<TAO_IIOP_Server_Connection_Handler> +#pragma instantiate ACE_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler> +#pragma instantiate ACE_Scheduling_Strategy<TAO_IIOP_Server_Connection_Handler> +#pragma instantiate TAO_Creation_Strategy<TAO_IIOP_Server_Connection_Handler> +#pragma instantiate TAO_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index c79d7b1de47..900dcc408bc 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -43,11 +43,11 @@ class TAO_Export TAO_IIOP_Acceptor : public TAO_Acceptor // The IIOP-specific bridge class for the concrete acceptor. // public: - // TAO_IIOP_Acceptor (ACE_INET_Addr &addr); - // Create Acceptor object using addr. - TAO_IIOP_Acceptor (void); - // Create Acceptor object using addr. + // Constructor. + + ~TAO_IIOP_Acceptor (void); + // Destructor. virtual int open (TAO_ORB_Core *orb_core, int version_major, @@ -79,7 +79,9 @@ public: // @@ Helper method for the implementation repository, should go // away - typedef TAO_Acceptor_Impl<TAO_IIOP_Server_Connection_Handler, ACE_SOCK_ACCEPTOR> TAO_IIOP_BASE_ACCEPTOR; + typedef ACE_Strategy_Acceptor<TAO_IIOP_Server_Connection_Handler, ACE_SOCK_ACCEPTOR> TAO_IIOP_BASE_ACCEPTOR; + typedef TAO_Creation_Strategy<TAO_IIOP_Server_Connection_Handler> TAO_IIOP_CREATION_STRATEGY; + typedef TAO_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler> TAO_IIOP_CONCURRENCY_STRATEGY; private: int open_i (TAO_ORB_Core* orb_core, @@ -90,6 +92,10 @@ private: TAO_IIOP_BASE_ACCEPTOR base_acceptor_; // the concrete acceptor, as a pointer to it's base class. + TAO_IIOP_CREATION_STRATEGY *creation_strategy_; + TAO_IIOP_CONCURRENCY_STRATEGY *concurrency_strategy_; + // Acceptor strategies. + ACE_INET_Addr address_; ACE_CString host_; // Cache the information about the endpoint serviced by this diff --git a/TAO/tao/UIOP_Acceptor.cpp b/TAO/tao/UIOP_Acceptor.cpp index 5f0ca844935..a7f8725dff2 100644 --- a/TAO/tao/UIOP_Acceptor.cpp +++ b/TAO/tao/UIOP_Acceptor.cpp @@ -36,6 +36,8 @@ ACE_RCSID(tao, UIOP_Acceptor, "$Id$") TAO_UIOP_Acceptor::TAO_UIOP_Acceptor (void) : TAO_Acceptor (TAO_IOP_TAG_UNIX_IOP), base_acceptor_ (), + creation_strategy_ (0), + concurrency_strategy_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0), unlink_on_close_ (1) @@ -48,6 +50,9 @@ TAO_UIOP_Acceptor::~TAO_UIOP_Acceptor (void) // close() is called to ensure that the rendezvous point is removed // from the filesystem. this->close (); + + delete this->creation_strategy_; + delete this->concurrency_strategy_; } int @@ -155,11 +160,23 @@ TAO_UIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, { this->orb_core_ = orb_core; + ACE_NEW_RETURN (this->creation_strategy_, + TAO_IIOP_CREATION_STRATEGY (this->orb_core_), + -1); + + ACE_NEW_RETURN (this->concurrency_strategy_, + TAO_IIOP_CONCURRENCY_STRATEGY (this->orb_core_), + -1); + ACE_UNIX_Addr addr; this->rendezvous_point (addr, rendezvous); - if (this->base_acceptor_.open (orb_core, addr) != 0) + if (this->base_acceptor_.open (addr, + this->orb_core_->reactor (), + this->creation_strategy_, + 0, + this->concurrency_strategy_) == -1) { // Don't unlink an existing rendezvous point since it may be in // use by another UIOP server/client. @@ -236,13 +253,25 @@ TAO_UIOP_Acceptor::endpoint_count (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Acceptor<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR>; -template class TAO_Acceptor_Impl<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR>; +template class ACE_Acceptor<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Strategy_Acceptor<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Accept_Strategy<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; +template class ACE_Creation_Strategy<TAO_UIOP_Server_Connection_Handler>; +template class ACE_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler>; +template class ACE_Scheduling_Strategy<TAO_UIOP_Server_Connection_Handler>; +template class TAO_Creation_Strategy<TAO_UIOP_Server_Connection_Handler>; +template class TAO_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Acceptor<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR> -#pragma instantiate TAO_Acceptor_Impl<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR> +#pragma instantiate ACE_Acceptor<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Strategy_Acceptor<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<TAO_UIOP_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> +#pragma instantiate ACE_Creation_Strategy<TAO_UIOP_Server_Connection_Handler> +#pragma instantiate ACE_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler> +#pragma instantiate ACE_Scheduling_Strategy<TAO_UIOP_Server_Connection_Handler> +#pragma instantiate TAO_Creation_Strategy<TAO_UIOP_Server_Connection_Handler> +#pragma instantiate TAO_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/UIOP_Acceptor.h b/TAO/tao/UIOP_Acceptor.h index 67417e11644..3f2b63d9e87 100644 --- a/TAO/tao/UIOP_Acceptor.h +++ b/TAO/tao/UIOP_Acceptor.h @@ -79,7 +79,9 @@ public: CORBA::ULong endpoint_count (void); // return the number of profiles this will generate - typedef TAO_Acceptor_Impl<TAO_UIOP_Server_Connection_Handler,ACE_LSOCK_ACCEPTOR> TAO_UIOP_BASE_ACCEPTOR; + typedef TAO_Acceptor_Impl<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR> TAO_UIOP_BASE_ACCEPTOR; + typedef TAO_Creation_Strategy<TAO_UIOP_Server_Connection_Handler> TAO_UIOP_CREATION_STRATEGY; + typedef TAO_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler> TAO_UIOP_CONCURRENCY_STRATEGY; private: int open_i (TAO_ORB_Core *orb_core, const char *rendezvous); @@ -93,6 +95,10 @@ private: TAO_UIOP_BASE_ACCEPTOR base_acceptor_; // the concrete acceptor, as a pointer to its base class. + TAO_UIOP_CREATION_STRATEGY *creation_strategy_; + TAO_UIOP_CONCURRENCY_STRATEGY *concurrency_strategy_; + // Acceptor strategies. + TAO_GIOP_Version version_; // The GIOP version for this endpoint |